【发布时间】:2021-10-03 09:27:46
【问题描述】:
假设我有以下文件:
{_id: "mycollection/key",
_key: "key",
users: ["userKeyA","userKeyB","userKeyC"]
}
我可以为 _id 和 users 创建一个持久索引以加快查找用户键的时间吗?
【问题讨论】:
假设我有以下文件:
{_id: "mycollection/key",
_key: "key",
users: ["userKeyA","userKeyB","userKeyC"]
}
我可以为 _id 和 users 创建一个持久索引以加快查找用户键的时间吗?
【问题讨论】:
是的,你可以。
db.<collection>.ensureIndex({fields:["users", "_key"], type:"persistent");
【讨论】: