Start a new topic

Create a Query inside a loop ?


i want to create a query containing several id's as a possible operation.

_query.equalTo('channel._id', "12345").or().equalTo('channel._id', "12345").or()..... and so on

I have to create this type of query inside a, let's say, _.each loop - how can i consctruct this? Everything i tried doesn't work.

Any hint would be great, how to solve this.

Best, Nico

This isn't really a use case that would be supported well by our query builder.  You would need to know the number of "or"'s in advance (see: before compilation).  If you aren't aware of the number of items at compile time, to my knowledge you can't really do this easily using the Javascript SDK.  This may be something that we want to look into going forward though.

Thanks for the suggestion.

Hmm that's sad - please look forward to this!

I'll try to "hack" this into the sdk, cause the "_filter" seems just to be a normal js object.

Any other idea for solving this at the moment? calling XX requests (for example with async.js) seems to be very ugly)

best, Nico

Login or Signup to post a comment