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
  • 14,650
  • 11
  • 68
  • 119
user_531
  • 241
  • 4
  • 15
  • 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