* Adds error reproduction

* Fix transform in order to accept nested array results in $in/$nin

The error originated by the nesting of 2 array in $in [["..."]], using _.flatMap with those will guarantee at the lower level
that the query is properly resolved

* nits

* _.flatMap the $in/$nin values
This commit is contained in:
Florent Vilmart
2016-12-07 20:03:40 -05:00
committed by GitHub
parent 025e7a3218
commit 752f0e9143
3 changed files with 52 additions and 15 deletions

View File

@@ -1,5 +1,6 @@
import { createClient } from './PostgresClient';
import Parse from 'parse/node';
import _ from 'lodash';
const PostgresRelationDoesNotExistError = '42P01';
const PostgresDuplicateRelationError = '42P07';
@@ -296,10 +297,10 @@ const buildWhereClause = ({ schema, query, index }) => {
}
}
if (fieldValue.$in) {
createConstraint(fieldValue.$in, false);
createConstraint(_.flatMap(fieldValue.$in, elt => elt), false);
}
if (fieldValue.$nin) {
createConstraint(fieldValue.$nin, true);
createConstraint(_.flatMap(fieldValue.$nin, elt => elt), true);
}
}