1

I am trying to query in mongo using the $in . however the result i see are not in same order as i had passed them .

var objectids = [
  "111",
  "222"
]
db.sample.aggregate([{$match:{someFields:{ $in: objectFieldIds }}}])

How the value return will be 222, 111. How does this happen?

sidgate
  • 13,104
  • 9
  • 60
  • 107
user_531
  • 241
  • 2
  • 14
  • 1
    Possible duplicate of [Does MongoDB's $in clause guarantee order](https://stackoverflow.com/questions/22797768/does-mongodbs-in-clause-guarantee-order) – sidgate Feb 09 '18 at 06:43

0 Answers0