在 MongoDB 中,我有以下文档
{
"_id": { "$oid" : "4FFD813FE4B0931BDAAB4F01" },
"concepts": {
"blabla": 20,
"blibli": 100,
"blublu": 250,
... (many more here)
}
}
而且我想索引它以便能够查询“概念”数组的“键”(我知道它不是真正的 mongoDB 数组......):
db.things.find({concepts:blabla});
上面的架构可以吗?或者我应该将我的文件重构为类似
{
"_id": { "$oid" : "4FFD813FE4B0931BDAAB4F01" },
"concepts": ["blabla","blibli","blublu", ... (many more here)]
}
}