Last notEqualTo modifier overriedes the previous one

In the code below only the last notEqualTo modifier takes effect. I.e. it overrides the one that came before it. Is it possible to apply 2 notEqualTo modifiers for the same field?

const query = new Parse.Query("Comments");
query.notEqualTo("status", "angry");
query.notEqualTo("status", "happy");

query.equalTo("abc", "cde");
... other parameters

const result = await query.first({ useMasterKey: true })

I tried this method but it didn’t work either:

const notAngry = new Parse.Query("Comments");
notAngry.notEqualTo("status", "angry");

const notHappy = new Parse.Query("Comments");
notHappy.notEqualTo("status", "happy");

const mainQuery = Parse.Query.or(notAngry, notHappy);
mainQuery.equalTo("abc", "cde");
other params...
const result = await mainQuery.first({useMasterKey: true});

You can use query.notContainedIn("status", ["angry", "happy"]);

1 Like