0

I want to find a bunch of users in order using an array of ids. The array might look like this:

var array = [ '123', '42312124', '1231aoicali3' ];

This list is ordered, and I really want the users to appear in that order. I've noticed that reordering the same list does not reorder the documents I receive. Is there any way I can specify the order? The query I'm using right now is:

User.find({ '_id': { $in: array }})

I'm using NodeJS with Mongoose if that makes any difference.

ritmatter
  • 3,448
  • 4
  • 24
  • 43

0 Answers0