Eric Cochran
Eric Cochran

Reputation: 8574

Android Parse -- ParseQuery with List equality condition for field/column

I am using Parse, and I just want to get all the entries in my data class that have a certain List in my "blah" field/column.

final ParseQuery<Data> query = ParseQuery.getQuery(Data.class);
query.whereEqualTo("blah", mSomeValueList);
query.setLimit(MAX_DATA_TO_SHOW);
query.orderByAscending("createdAt");
// Execute query for messages asynchronously
query.findInBackground(new FindCallback<Data>() {...});

I had hoped it would be that simple, but I get the following exception when trying to run the query: com.parse.ParseException: equality needs a value instead of [value0, value1, ...]

How can I get my List of Data objects that have this condition?

Upvotes: 4

Views: 933

Answers (1)

Joel
Joel

Reputation: 838

You can always use whereEqualTowhereEqualTo

public ParseQuery<T> whereEqualTo(String key,
                                  Object value)
Add a constraint to the query that requires a particular key's value to be equal to the provided value.
Parameters:
key - The key to check.
value - The value that the ParseObject must contain.
Returns:
Returns the query, so you can chain this call.,

there is also a whereContainsAll, whereMatchesQuery, whereDoesNotMatchQuery, and so on..

For detailed documentation refer to this link

Hope it helps.

Upvotes: 1

Related Questions