Skip to content
/ qry Public
forked from manuelstofer/qry

Creates match functions from MongoDB query objects.

Notifications You must be signed in to change notification settings

Toolpark/qry

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

qry

Build Status

MongoDB query compatible object match

Installation

npm install qry
component install manuelstofer/qry

Usage

var qry = require('qry');

var match = qry({
    name: {$exists: true},
    qty: {$gt: 3},
    $and: [
        {price: {$lt: 100}},
        {price: {$gt: 50}}
    ]
});

match({name: 'example', qty: 10, price: 65.10});    // -> true
match({name: 'bla', qty: 10, price: 30.10});        // -> false

Please checkout the query selector section in the mongo db reference.

Supported operators

  • All comparison operators
  • All logical operators
  • All element operators except $type
  • All JavaScript operators
  • All array operators

Following operators are currently not supported:

  • All geospatial operators
  • $type operator

The $where operator is supported but disabled by default (security).

var match = qry(query, {$where: true});

About

Creates match functions from MongoDB query objects.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%