Indexing 使用$or选择器时,此选择器没有可用的索引
我想取回Indexing 使用$or选择器时,此选择器没有可用的索引,indexing,couchdb,cloudant,couchdb-mango,Indexing,Couchdb,Cloudant,Couchdb Mango,我想取回 具有\u id的1 或 文件的值===13和另一个值===56 错误: 此选择器没有可用的索引 这是我的疑问: { "selector": { "$or": [ { "_id": "1" }, { "value": "13", "anotherValue": "56" } ] } }
- 具有
的\u id
或1
- 文件的
和值===13
另一个值===56
{
"selector": {
"$or": [
{
"_id": "1"
},
{
"value": "13",
"anotherValue": "56"
}
]
}
}
索引设置:
Your available Indexes:
special: _id
json: value, anotherValue
json: _id, value, anotherValue
对于此查询,您需要添加一个选择器以获取所有ID,如下所示:
{
"selector": {
"_id": {"$gt":null},
"$or": [
{
"_id": "1"
},
{
"value": "13",
"anotherValue": "56"
}
]
}
}
您可以在此处了解更多信息:
这篇文章:
或者,您可以在所有字段上添加文本索引:
{
"index": {},
"type": "text"
}
然后您的原始选择器应该可以工作。对于此查询,您需要添加一个选择器以获取所有ID,如下所示:
{
"selector": {
"_id": {"$gt":null},
"$or": [
{
"_id": "1"
},
{
"value": "13",
"anotherValue": "56"
}
]
}
}
您可以在此处了解更多信息:
这篇文章:
或者,您可以在所有字段上添加文本索引:
{
"index": {},
"type": "text"
}
然后您原来的选择器就可以工作了。谢谢!你有没有可能看一看这个(类似,但使用
排序
):谢谢!您是否有可能看一下这个(类似,但使用sort
):