Does MongoDB's $in clause guarantee order

后端 未结 10 1270
春和景丽
春和景丽 2020-11-22 01:39

When using MongoDB\'s $in clause, does the order of the returned documents always correspond to the order of the array argument?

10条回答
  •  故里飘歌
    2020-11-22 02:19

    You can guarantee order with $or clause.

    So use $or: [ _ids.map(_id => ({_id}))] instead.

提交回复
热议问题