Reputation: 43
I want to construct a ParseQuery
for some data, and I'm looking to return objects that have a particular field either undefined, or with a particular value. Is this possible, or do I have to find all of the values I don't want it to have, and use whereNotEqualTo
or whereNotContainedIn
?
Upvotes: 0
Views: 327
Reputation: 5020
You need to use Compound Queries
ParseTest
is class with Value
field. It's String
type. Table contains next rows
undefined
ParseQuery<TestParse> queryUndefined = ParseQuery.getQuery(TestParse.class);
queryUndefined.whereDoesNotExist("Value");
ParseQuery<TestParse> queryParticualValue = ParseQuery.getQuery(TestParse.class);
queryParticualValue.whereEqualTo("Value", "2");
ParseQuery<TestParse> orQuery = ParseQuery.or(Arrays.asList(queryUndefined, queryParticualValue));
List<TestParse> list = orQuery.find();
Result of query will contain '2' and undefined values.
Upvotes: 2