Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mquery

Package Overview
Dependencies
Maintainers
3
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mquery - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

5

History.md
1.2.0 / 2014-09-18
==================
* added; stream() support for find()
1.1.0 / 2014-09-15

@@ -3,0 +8,0 @@ ==================

13

lib/collection/collection.js

@@ -7,4 +7,13 @@ 'use strict';

var names = 'find findOne update remove count distict findAndModify aggregate';
var methods = names.split(' ');
var methods = [
'find'
, 'findOne'
, 'update'
, 'remove'
, 'count'
, 'distinct'
, 'findAndModify'
, 'aggregate'
, 'findStream'
];

@@ -11,0 +20,0 @@ /**

9

lib/collection/node.js

@@ -82,8 +82,11 @@ 'use strict';

/**
* aggregation(operators..., function(err, doc))
* TODO
* var stream = findStream(match, findOptions, streamOptions)
*/
NodeCollection.prototype.findStream = function(match, findOptions, streamOptions) {
return this.collection.find(match, findOptions).stream(streamOptions);
}
/**
* Streams
* aggregation(operators..., function(err, doc))
* TODO

@@ -90,0 +93,0 @@ */

@@ -2255,2 +2255,23 @@ 'use strict';

/**
* Returns a stream for the given find query.
*
* @throws Error if operation is not a find
* @returns {Stream} Node 0.8 style
*/
Query.prototype.stream = function(streamOptions) {
if ('find' != this.op)
throw new Error('stream() is only available for find');
var conds = this._conditions;
var options = this._optionsForExec()
options.fields = this._fieldsForExec()
debug('stream', conds, options, streamOptions);
return this._collection.findStream(conds, options, streamOptions);
}
/**
* Determines if field selection has been made.

@@ -2257,0 +2278,0 @@ *

{
"name": "mquery",
"version": "1.1.0",
"version": "1.2.0",
"description": "Expressive query building for MongoDB",

@@ -20,3 +20,3 @@ "main": "lib/mquery.js",

"devDependencies": {
"mongodb": "1.4.4",
"mongodb": "1.4.12",
"mocha": "1.9.x",

@@ -23,0 +23,0 @@ "istanbul": "0.3.2"

@@ -54,2 +54,3 @@ #mquery

- [exec](#exec)
- [stream](#stream)
- [all](#all)

@@ -337,2 +338,16 @@ - [and](#and)

###stream()
Executes the query and returns a stream.
```js
var stream = mquery().find().stream(options);
stream.on('data', cb);
stream.on('close', fn);
```
Note: this only works with `find()` operations.
Note: returns the stream object directly from the node-mongodb-native driver. (currently streams1 type stream). Any options will be passed along to the [driver method](http://mongodb.github.io/node-mongodb-native/api-generated/cursor.html#stream).
-------------

@@ -339,0 +354,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc