
Product
Introducing Repository Labels and Security Policies
Socket is introducing a new way to organize repositories and apply repository-specific security policies.
mongo-query-parse-filter
Advanced tools
Lightweight package that allows you to easily convert complex, human-readable query filters into MongoDB-compatible query syntax, supporting logical operations like `AND`, `OR`, `NOT`, `IN`, `NIN` and various comparison operators
Lightweight package that allows you to easily convert complex, human-readable query filters into MongoDB-compatible query syntax, supporting logical operations like AND
, OR
, NOT
, IN
, NIN
and various comparison operators
To install the package, use npm:
npm i mongo-query-parse-filter
const { MongoQuery } = require('mongo-query-parse-filter');
const mongoQuery = new MongoQuery();
const query = mongoQuery.buildQuery('(email eq "jhon@example.com")')
console.log(query)
{
"email": { "$eq": "jhon@example.com" }
}
(email regex "(?i)@example.com$")
{
"email": { "$regex": "(?i)@example.com$" }
}
(email eq "jhon@example.com") or (username eq "alice")
{
"$or": [
{
"email": { "$eq": "jhon@example.com" }
},
{
"username": { "$eq": "alice" }
}
]
}
(not ((department eq "Marketing") or (department eq "Sales")))
to find all employees who are not either in the Marketing or Sales departments
{
"$not": {
"$or": [
{
"department": { "$eq": "Marketing" }
},
{
"department": { "$eq": "Sales" }
}
]
}
}
(email in "'alice@example.com','jhon@example.com'")
{
"email": { "$in": [ "alice@example.com", "jhon@example.com"] }
}
FAQs
Lightweight package that allows you to easily convert complex, human-readable query filters into MongoDB-compatible query syntax, supporting logical operations like `AND`, `OR`, `NOT`, `IN`, `NIN` and various comparison operators
The npm package mongo-query-parse-filter receives a total of 5 weekly downloads. As such, mongo-query-parse-filter popularity was classified as not popular.
We found that mongo-query-parse-filter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Product
Socket is introducing a new way to organize repositories and apply repository-specific security policies.
Research
Security News
Socket researchers uncovered malicious npm and PyPI packages that steal crypto wallet credentials using Google Analytics and Telegram for exfiltration.
Product
Socket now supports .NET, bringing supply chain security and SBOM accuracy to NuGet and MSBuild-powered C# projects.