简体   繁体   中英

How to use multiple equal to queries in Parse

I am trying to return all items in a list where their ID is equal to an ID from an array. I run the following code:

for (ss in sets) {
    query.equalTo("setsID", {
        __type: "Pointer",
        className: "Sets",
        objectId: sets[ss].objectId});
}

The issue is that I only get results from the last set of items. It's like the equalTo gets overwritten each time. Is there a better way to configure this?

I was able to get it working by creating a temporary query and using the Parse.Query.or method to combine the queries.

for(ss in sets){
    tempQuery.equalTo("setsID", {
        __type: "Pointer",
        className: "Sets",
        objectId: sets[ss].objectId});
    query = Parse.Query.or(query, tempQuery);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM