mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Don't load full query results in findOne()
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
|
||||
## vNEXT
|
||||
|
||||
* Calling `findOne()` on the server no longer loads the full query result
|
||||
into memory.
|
||||
|
||||
* Fix Spark memory leak. #1157
|
||||
|
||||
* Upgraded dependencies:
|
||||
|
||||
@@ -655,7 +655,8 @@ disable this behavior, pass `{reactive: false}` as an option to
|
||||
|
||||
{{> api_box findone}}
|
||||
|
||||
Equivalent to `find(selector, options).fetch()[0]`.
|
||||
Equivalent to `find(selector, options).fetch()[0]` with
|
||||
`options.limit = 1`.
|
||||
|
||||
{{> api_box insert}}
|
||||
|
||||
|
||||
@@ -288,7 +288,8 @@ _Mongo.prototype.findOne = function (collection_name, selector, options) {
|
||||
if (arguments.length === 1)
|
||||
selector = {};
|
||||
|
||||
// XXX use limit=1 instead?
|
||||
options = options || {};
|
||||
options.limit = 1;
|
||||
return self.find(collection_name, selector, options).fetch()[0];
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user