Icontem

Mongo Filter: Filter collection elements with mongoQuery syntax

Recommend this page to a friend!
  Info   View files Documentation   View files View files (14)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2017-01-07 (16 hours ago) RSS 2.0 feedNot yet rated by the usersTotal: 53 This week: 4All time: 463 This week: 15Up
Version License JavaScript version Categories
mongo-filter 1.0.5MIT/X Consortium ...5Data types
Description Author

This package can filter collection elements with mongoQuery syntax.

It can create filters that take a definition of criteria like mongoQuery for traversing and returning collection elements that match that criteria.

The filter criteria is defined by an object that defines names of elements to match and the criteria expressions that the property elements must satisfy.

Currently it supports criteria with comparators like $gt, $gte, $lt, $lte, $eq, $ne, $regex, $like, $nlike, $in and $nin.

Filters may also be combined with logical operators like and, or, nor and not.

Innovation Award
JavaScript Programming Innovation award winner
July 2015
Winner


Prize: One book of choice by Packt
Sometimes you have a collection of objects that you need to filter and find those that match a given condition.

This object provides an object filtering solution that matches conditions using a syntax like that used for MongoDB queries.

Manuel Lemos
  Performance   Level  
Name: Jonathan Gotti <contact>
Classes: 8 packages by
Country: France France
Innovation award
Innovation award
Nominee: 5x

Winner: 3x

Details

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_

  Files folder image Files  
File Role Description
Files folder imagedist (4 directories)
Files folder imagejs (1 file)
Files folder imagetests (1 file)
Accessible without login Plain text file AUTHORS Data Authors
Accessible without login Plain text file bower.json Data Sample output
Accessible without login Plain text file index.d.ts Data Auxiliary data
Accessible without login Plain text file package.json Data Sample output
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  dist  
File Role Description
Files folder imageamd (2 files)
Files folder imagecommonjs (1 file)
Files folder imagesystem (2 files)
Files folder imageumd (2 files)

  Files folder image Files  /  dist  /  amd  
File Role Description
  Plain text file mongofilter.js Class Class source
  Plain text file mongofilter.min.js Class Class source

  Files folder image Files  /  dist  /  commonjs  
File Role Description
  Plain text file mongofilter.js Class Class source

  Files folder image Files  /  dist  /  system  
File Role Description
  Plain text file mongofilter.js Class Class source
  Plain text file mongofilter.min.js Class Class source

  Files folder image Files  /  dist  /  umd  
File Role Description
  Plain text file mongofilter.js Class Class source
  Plain text file mongofilter.min.js Class Class source

  Files folder image Files  /  js  
File Role Description
  Plain text file mongofilter.es6 Class Auxiliary data

  Files folder image Files  /  tests  
File Role Description
  Accessible without login Plain text file test.js Test Unit test script

 Version Control Unique User Downloads Download Rankings  
 100%
Total:53
This week:4
All time:463
This week:15Up