pg support for null in containedAll (#4026)
This commit is contained in:
committed by
Florent Vilmart
parent
3c79cae1b2
commit
811d8b0c7a
@@ -274,6 +274,21 @@ describe('Parse.Query testing', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('containedIn null array', (done) => {
|
||||||
|
const emails = ['contact@xyz.com', 'contact@zyx.com', null];
|
||||||
|
const user = new Parse.User();
|
||||||
|
user.setUsername(emails[0]);
|
||||||
|
user.setPassword('asdf');
|
||||||
|
user.signUp().then(() => {
|
||||||
|
const query = new Parse.Query(Parse.User);
|
||||||
|
query.containedIn('username', emails);
|
||||||
|
return query.find({ useMasterKey: true });
|
||||||
|
}).then((results) => {
|
||||||
|
equal(results.length, 1);
|
||||||
|
done();
|
||||||
|
}, done.fail);
|
||||||
|
});
|
||||||
|
|
||||||
it("containsAll number array queries", function(done) {
|
it("containsAll number array queries", function(done) {
|
||||||
var NumberSet = Parse.Object.extend({ className: "NumberSet" });
|
var NumberSet = Parse.Object.extend({ className: "NumberSet" });
|
||||||
|
|
||||||
|
|||||||
@@ -301,8 +301,10 @@ const buildWhereClause = ({ schema, query, index }) => {
|
|||||||
const inPatterns = [];
|
const inPatterns = [];
|
||||||
values.push(fieldName);
|
values.push(fieldName);
|
||||||
baseArray.forEach((listElem, listIndex) => {
|
baseArray.forEach((listElem, listIndex) => {
|
||||||
values.push(listElem);
|
if (listElem !== null) {
|
||||||
inPatterns.push(`$${index + 1 + listIndex}`);
|
values.push(listElem);
|
||||||
|
inPatterns.push(`$${index + 1 + listIndex}`);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
patterns.push(`$${index}:name ${not} IN (${inPatterns.join(',')})`);
|
patterns.push(`$${index}:name ${not} IN (${inPatterns.join(',')})`);
|
||||||
index = index + 1 + inPatterns.length;
|
index = index + 1 + inPatterns.length;
|
||||||
|
|||||||
Reference in New Issue
Block a user