mongofilter

2.0.0 • Public • Published

mongofilter

Filtering elements in collection based on json filters with a mongoQuery like syntax Build Status

Basic usage:

var filter = mongofilter({name:{$like: '%test%'}, age:12});
// filtering a complete collection
filter.filter(collection);
// or alternatively
collection.filter(filter);
 
// check a single item match against given filter
filter.filterItem(item); // return true or false
 
// also you can call 'and' or 'or' on the predicate directly:
filter.and({prop:val}).filter(collection);
filter.or({prop:val}).filter(collection);

Comparison operators

Greater than: $gt

Greater Equal than: $gte

Less than: $lt

Less Equal than: $lte

Strict equality: $eq

Strict inequality: $ne

Text matching operators

Like: $like

Not like: $nlike

RegExp: $regex

Subset operator

In: $in

Not in: $nin

Logical operators

And: $and

Or: $or

Nor: $nor

Not: $not

Dependencies (0)

    Dev Dependencies (4)

    Package Sidebar

    Install

    npm i mongofilter

    Weekly Downloads

    1

    Version

    2.0.0

    License

    MIT

    Last publish

    Collaborators

    • malko
    • adriengibrat