mongodbindexingmongodb-query

Is MongoDB $in operator an Equality or a Range?


when building an index in mongoDB using the ESR rule
will the operator $in considered as Equality type or as Range type ?


Solution

  • Sorry, i am not able to answer more clearly than the documentation says, that $in acts like range, when used with .sort()

    https://www.mongodb.com/docs/manual/tutorial/equality-sort-range-rule/#additional-considerations