db.yourCollection.ensureIndex({"fruit.name":1})
Mongodb, create index on a subdocument which is a list
Frage
Is it possible to create index on name
field in fruit
subdocument ?
{
"trees": 5,
"fruit":[{"name":"apple", "color":"red"}, {"name":"pear", "color":"green"}]
}
Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow