我有一个包含description
这样一个字段的文档:
{
"_id": "item0",
"description": {
"parlist": [
{
"listitem": {
"text": {
"child": "page rous lady",
"keyword": "officer e"
}
}
},
{
"listitem": {
"text": "shepherd noble "
}
}
]
}
}
如何创建文本索引description
并搜索特定单词?不知道深度能description
走多远,描述的孩子会有多少。我尝试像这样创建索引:
db.collection.ensureIndex({description:"text"})
然后像这样查询:
db.collection.runCommand("text",{$search:"shepherd"})
但它不起作用。