In MongoDB how do you index an embedded object fields in an array?

前端 未结 2 1240
暖寄归人
暖寄归人 2021-02-01 03:00

The mongodb documentation for multikeys gives an example of querying embedded object fields in an array:

http://www.mongodb.org/display/DOCS/Multikeys

But there\

2条回答
  •  北海茫月
    2021-02-01 03:46

    you create the index as if you would with a "normal" field;

    db.[collection].ensureIndex( { [yourArrayField] : 1 } )
    

提交回复
热议问题