eugeneware/jsonquery

语言: JavaScript

git: https://github.com/eugeneware/jsonquery

MongoDB查询语言实现为node.js Stream
MongoDB query language implemented as a node.js Stream
README.md (中文)

jsonquery

MongoDB查询语言实现为Streaming过滤器。

该库将整个MongoDB查询语言实现为node.js 过滤流;

build status

安装

要安装,请使用npm:

$ npm install jsonquery

例子

这是一个用法示例:

var jsonquery = require('jsonquery');

var count = 0;
generator(100) // a readable stream that outputs JSON documents
  .pipe(jsonquery({ val: { $and: [ { $gt: 970 }, { $gt: 950 } ] } })) // filter
  .on('data', function (doc) {
    expect(doc.val).to.be.above(970);
    expect(doc.val).to.be.above(950);
    count++;
  })
  .on('end', function () {
    expect(count).to.equal(2);
  });

本文使用googletrans自动翻译,仅供参考, 原文来自github.com

en_README.md

jsonquery

MongoDB query language implemented as a Streaming filter.

This library implements the entire MongoDB query language as a node.js
filtering stream;

build status

Installation

To install, use npm:

$ npm install jsonquery

Examples

Here's an example of usage:

var jsonquery = require('jsonquery');

var count = 0;
generator(100) // a readable stream that outputs JSON documents
  .pipe(jsonquery({ val: { $and: [ { $gt: 970 }, { $gt: 950 } ] } })) // filter
  .on('data', function (doc) {
    expect(doc.val).to.be.above(970);
    expect(doc.val).to.be.above(950);
    count++;
  })
  .on('end', function () {
    expect(count).to.equal(2);
  });