@sidewinder/query
v0.14.0
Published
Sidewinder Query
Downloads
11
Readme
Overview
This package provides a query expression syntax for constructing mongo filters from JavaScript like expressions.
import { Query } from '@sidewinder/query'
const Q = Query(`
user_id === '6364ed67a7e953d089dbe23d' && (
record.name === 'foo' ||
record.desc === 'bar'
)
`)
// const Q = {
// "$and": [
// {
// "user_id": "6364ed67a7e953d089dbe23d"
// },
// {
// "$or": [
// {
// "record.name": "foo"
// },
// {
// "record.desc": "bar"
// }
// ]
// }
// ]
// }
const results = await collection.find(Q).toArray()