Does Key order matter in a MongoDB BSON doc?

两盒软妹~` 提交于 2019-12-05 08:56:57

The order of a document's properties does not affect indexing.

You can see this for yourself by running this query:

db.people.find({LName: "abc"}).explain()

and then this query:

db.people.find({LName: "jkl"}).explain()

you should see that MongoDB will use the index in both cases (the cursor property should be something like "BtreeCursor LName_1_FName_1").

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!