Adding Mongodb element to add arrayMatches the #4762 (#4766)

* Adding elemMatch and nor

* lint

* adding test

* adding edge test

* postgres support

* clean up

* empty test
This commit is contained in:
Jérémy Piednoel
2018-05-18 09:35:50 -04:00
committed by Diamond Lewis
parent ad244d6654
commit c0f86ae1d1
3 changed files with 133 additions and 0 deletions

View File

@@ -446,6 +446,20 @@ const buildWhereClause = ({ schema, query, index }): WhereClause => {
index += 1;
}
if (fieldValue.$containedBy) {
const arr = fieldValue.$containedBy;
if (!(arr instanceof Array)) {
throw new Parse.Error(
Parse.Error.INVALID_JSON,
`bad $containedBy: should be an array`
);
}
patterns.push(`$${index}:name <@ $${index + 1}::jsonb`);
values.push(fieldName, JSON.stringify(arr));
index += 2;
}
if (fieldValue.$text) {
const search = fieldValue.$text.$search;
let language = 'english';