
Security News
libxml2 Maintainer Ends Embargoed Vulnerability Reports, Citing Unsustainable Burden
Libxml2’s solo maintainer drops embargoed security fixes, highlighting the burden on unpaid volunteers who keep critical open source software secure.
@query-easy/mongo
Advanced tools
A query builder for MongoDB, built to provide a rich and dynamic query building interface.
A query builder for MongoDB, built to provide a rich and dynamic query building interface.
const qe = require('@query-easy/mongo');
const query = qe('office_collection')
.eq('character_name', 'Michael Scott')
.or((cb) => {
cb.in('fav_restaurants', ['chillis', 'benihana'])
})
.all('hobbies', ['parkour', 'rap'])
.regex('prison_name', new RegExp('prisonmike', 'i'))
.offset(5)
.raw('age', '>=', 96)
.exists('department', true)
.raw('sort', ['name', 'age'])
.toQuery();
/*
query = {
filter: {
character_name: 'Michael Scott',
$or: [
{fav_restaurants: {'$in': ['chillis', 'benihana']}},
]
hobbies: {'$all': ['parkour', 'rap']},
prison_name: {'$regex': /prisonmike/i},
age: {'$gte': 96},
department: {'$exists': true}
},
options: {
skip: 5, sort: {name: 1, age: 1}
}
}
*/
More examples here
const qe = require('@query-easy/mongo');
const query = qe('office_collection')
.eq('character_name', 'Michael Scott')
.or((cb) => {
cb.in('fav_restaurants', ['chillis', 'benihana'])
})
.all('hobbies', ['parkour', 'rap'])
.regex('prison_name', new RegExp('prisonmike', 'i'))
.offset(5)
.raw('age', '>=', 96)
.exists('department', true)
.raw('sort', ['name', 'age'])
.toQuery();
// MongoDB Ex.
let collection = mongodb().collection('office_collection');
collection.find(
query.filter,
query.options
).toArray((err, docs) => {
// do some stuff...
})
// Mongoose Ex.
let filter = query.filter;
let options = query.options;
// Following line is added because mongoose find() does not want projection in options
let projection = query.options.projection;
delete options.projection;
MongooseModel.find(filter, projection, options, (err, docs) => {
// do some stuff...
})
Refer API.md
FAQs
A query builder for MongoDB, built to provide a rich and dynamic query building interface.
The npm package @query-easy/mongo receives a total of 0 weekly downloads. As such, @query-easy/mongo popularity was classified as not popular.
We found that @query-easy/mongo demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Libxml2’s solo maintainer drops embargoed security fixes, highlighting the burden on unpaid volunteers who keep critical open source software secure.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.