Problem using containedIn with multiple values

Hello guys,

We are trying to do a ParseQuery using containedIn to get objects that match the values. We are parsing more than 200 values in array.

We are receving the bad request error, there is another way to do this query

Does same error happens when yo use with smaller array?

I use same query with 40 or less objects and works fine.

The behavior is normal, should not pass this amount of data into a query, it result into bad performance or error due to the body size of the request. If you need to do this query you should reworks your data architecture or use a batch system with small amount of parameters (10-20). :slight_smile:

1 Like

Ä°s 40 objects on array ok? My array has 40 parse objects . Does this causes bad performance?

If it works on your side for a specific query I would like to say yes.

But from my experience, if your request params can scale to N+X ( 10 params, 20 params, and sometime 100 params), or depend from front user input, you should reworks your data architecture or your query strategy.

Bad performance is hard to define since if a developer work wirh a huge proxy, a huge Db and infra system network, it will work. But if you are at the beginning of your app, I will try to rework this (schema or query strategy) :slight_smile:

This is how I use query: @Moumouls

  const getPosts = new Parse.Query(Post);
  //additional options
  getPosts.limit(40);

  const postList = await getPosts.find({useMasterKey:true});
  if(postList.length<1){
    return postList;
  }




  const Like = Parse.Object.extend("Like");
  const getLikes = new Parse.Query(Like);
  getLikes.equalTo("owner",user);
  getLikes.containedIn("post",postList);

  const likeList = await getLikes.find({useMasterKey:true});

My query is not one complex query. I first get one query result then run another query with await option. So everything goes one by one.

I have only two options for the query where I use containedIn method.

getLikes.equalTo("owner",user);
getLikes.containedIn("post",postList);

And they are properly indexed in database. Its works fine when I test it. But Iā€™m only one person so I wonder if performance remains same when users scale up?