hasSome("field", array) query result sequence

Hi!

I wrote a query that returns items based on the ids that are stored in array.

wixData.query("collection").hasSome("_id", array).find()

Unfortunately, the items that are returned from the collection are not in the same sequence as the original array. Yes, I can sort them afterwards, but I have a very specific case in which I need to have the items returned in the right order.

How can I achieve that?

The idea is to have something like the following, where array contains > 1000 id’s, sorted by a specific parameter that is not available in collection.

wixData.query("collection")
.hasSome("_id", array)
.eq("status","active")
.limit(12)
.find()

Next, I would like to do the following:

while(results.hasNext()) {
 results = await results.next();
}

Thank you!

I didn’t understand what you need, but, have you tried .sort() ?

@Coding with Velo: not possible then? Can someone at least say something? :slight_smile: