0
是否可以在fruit
子文檔的name
字段上創建索引?Mongodb,在列表上創建索引
{
"trees": 5,
"fruit":[{"name":"apple", "color":"red"}, {"name":"pear", "color":"green"}]
}
是否可以在fruit
子文檔的name
字段上創建索引?Mongodb,在列表上創建索引
{
"trees": 5,
"fruit":[{"name":"apple", "color":"red"}, {"name":"pear", "color":"green"}]
}
db.yourCollection.ensureIndex({"fruit.name":1})
是否有文檔的鏈接?我還沒發現。 – ashim
http://docs.mongodb.org/manual/core/index-multikey/#index-arrays-with-embedded-documents –