I'm using the $in operator in a query in this way.
{ customer_id: "55681864527cb123208b4567",
_id: { $in: [
"56cf29693f2c755a0a8b459f", "56cde0213f2c756b0a8b4569", "56cddfbc3f2c75580a8b4567"
] }
These are the results.
{ "_id" : ObjectId("56cddfbc3f2c75580a8b4567"), "customer_id" : "55681864527cb123208b4567", "id" : "56cddfbc3f2c75580a8b4567"}
{ "_id" : ObjectId("56cde0213f2c756b0a8b4569"), "customer_id" : "55681864527cb123208b4567", "id" : "56cde0213f2c756b0a8b4569"}
{ "_id" : ObjectId("56cf29693f2c755a0a8b459f"), "customer_id" : "55681864527cb123208b4567", "id" : "56cf29693f2c755a0a8b459f"}
The results order don't respect my search order and that make sense.
I need that the results order begin with the id 56cf29693f2c755a0a8b459f and end with the id 56cddfbc3f2c75580a8b4567. Respecting my search order.
{ "_id" : ObjectId("56cf29693f2c755a0a8b459f"), "customer_id" : "55681864527cb123208b4567", "id" : "56cf29693f2c755a0a8b459f"}
{ "_id" : ObjectId("56cde0213f2c756b0a8b4569"), "customer_id" : "55681864527cb123208b4567", "id" : "56cde0213f2c756b0a8b4569"}
{ "_id" : ObjectId("56cddfbc3f2c75580a8b4567"), "customer_id" : "55681864527cb123208b4567", "id" : "56cddfbc3f2c75580a8b4567"}
But, there is any way to achieve that?.
Thanks.