Merge pull request #145 from Herteby/master

fix issue with adding fields from $filters
This commit is contained in:
Theodor Diaconu 2017-06-13 14:41:38 +03:00 committed by GitHub
commit 9b4ff8ddbc

View file

@ -90,8 +90,11 @@ export default class CollectionNode {
_.each(filters, (value, field) => { _.each(filters, (value, field) => {
// special handling for the $meta filter and conditional operators // special handling for the $meta filter and conditional operators
if (!_.contains(['$or', '$nor', '$not', '$and', '$meta'], field)) { if (!_.contains(['$or', '$nor', '$not', '$and', '$meta'], field)) {
hasAddedAnyField = true; // if the field or the parent of the field already exists, don't add it
options.fields[field] = 1; if (!_.has(options.fields, field.split('.')[0])){
hasAddedAnyField = true;
options.fields[field] = 1;
}
} }
}); });