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,9 +90,12 @@ 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)) {
// if the field or the parent of the field already exists, don't add it
if (!_.has(options.fields, field.split('.')[0])){
hasAddedAnyField = true; hasAddedAnyField = true;
options.fields[field] = 1; options.fields[field] = 1;
} }
}
}); });
if (!hasAddedAnyField) { if (!hasAddedAnyField) {