質問

Is it possible to create index on name field in fruit subdocument ?

{                                                                               
    "trees": 5,
    "fruit":[{"name":"apple", "color":"red"}, {"name":"pear", "color":"green"}]
}
役に立ちましたか?

解決

db.yourCollection.ensureIndex({"fruit.name":1})
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top