Optimized way of Querying in MongoDB using $in vs $or

前端 未结 4 1161
别那么骄傲
别那么骄傲 2020-12-03 15:09

Implementing an application that looks up a table for mail id presence from a list of around 10 email ids. Tried using $or and $in.

$in seems to give better performa

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-03 15:56

    MongoDB docs have the answer:

    "When using $or with that are equality checks for the value of the same field, choose the $in operator over the $or operator."

提交回复
热议问题