MongoDB : Indexes order and query order must match?

后端 未结 2 445
生来不讨喜
生来不讨喜 2020-12-15 17:18

This question concern the internal method to manage indexes and serching Bson Documents.

When you create a multiple indexes like \"index1\", \"index2\", \"index3\"..

2条回答
  •  情话喂你
    2020-12-15 17:30

    From http://www.mongodb.org/display/DOCS/Indexes:

    If you have a compound index on multiple fields, you can use it to query on the beginning subset of fields. So if you have an index on

    a,b,c

    you can use it query on

    a

    a,b

    a,b,c

    So yes, order matters. You should clarify your question a bit if you need a more precise answer.

提交回复
热议问题