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 –