mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Always sort keys to simplify some cases.
And don't modify the argument.
This commit is contained in:
@@ -1038,12 +1038,12 @@ LocalCollection._compileProjection = function (fields) {
|
||||
throw MinimongoError("Projection values should be one of 1, 0, true, or false");
|
||||
|
||||
var _idProjection = _.isUndefined(fields._id) ? true : fields._id;
|
||||
delete fields._id;
|
||||
var fieldsKeys = _.reject(_.keys(fields).sort(), function (key) { return key === '_id'; });
|
||||
var including = null; // Unknown
|
||||
var projectionRulesTree = {}; // Tree represented as nested objects
|
||||
|
||||
_.each(fields, function (rule, keyPath) {
|
||||
rule = !!rule;
|
||||
_.each(fieldsKeys, function (keyPath) {
|
||||
var rule = !!fields[keyPath];
|
||||
if (including === null)
|
||||
including = rule;
|
||||
if (including !== rule)
|
||||
|
||||
Reference in New Issue
Block a user