我有一个视图,它返回带有数组键的几个元素 示例:
{"total_rows":4,"offset":0,"rows":[
{"id":"","key":[15,"2"],"value":1,"doc":{},
{"id":"","key":[20,"2"],"value":1,"doc":{},
{"id":"","key":[20,"3"],"value":1,"doc":{},
{"id":"","key":[20,"4"],"value":1,"doc":{}
]}
我正在尝试搜索这些元素。因此,如果我执行以下请求:
/database/_design/element/_view/all/?
startkey=[15, "2"]&
endkey=[20, "3"]&
include_docs=true&reduce=false
实例:http://jchris.couchone.com/keyhuh/_design/Record/_view/by_CreationDate_and_BoreholeName?startkey=[1267686720,%22sp4%22]&endkey=[1267686725,%22sp4 \ u9999%22& include_docs = true& reduce = false
这个不起作用。它返回所有记录,即使是最后一个记录,也不符合数组的第二个元素。
奇怪的是,它仅适用于字符串 示例:
{"total_rows":4,"offset":0,"rows":[
{"id":"","key":["15","2"],"value":1,"doc":{},
{"id":"","key":["20","2"],"value":1,"doc":{},
{"id":"","key":["20","3"],"value":1,"doc":{},
{"id":"","key":["20","4"],"value":1,"doc":{}
]}
如果我执行以下请求:
/database/_design/element/_view/all/?
startkey=["15", "2"]&
endkey=["20", "3"]&
include_docs=true&
reduce=false
直播示例:http://jchris.couchone.com/keyhuh/_design/Record/_view/by_Client_and_BoreholeName?startkey=[%22Test1%22,%22sp4%22]&endkey=[%22Test1%22,%22sp4 \ u9999%22]& include_docs = true& reduce = false
这里效果很好,只返回三个第一个元素。
我是否遗漏了couchdb搜索带有整数和字符串的数组的内容?还是我陷入了一个错误?
注意:它与CouchDB 0.10和0.11相同。
答案 0 :(得分:3)
这看起来不对,有些事情可能会发生。您可以与我们分享您的代码吗?如果数据不是专有的,你可以将你的数据库复制到http://jchris.couchone.com/keyhuh,我会看看那里的全部内容。
...
感谢您发布实时数据。这是被破坏的查询?
http://jchris.couchone.com/keyhuh/_design/Record/_view/by_Client_and_BoreholeName?startkey=[%22Test1%22,%22sp4%22]&endkey=[%22Test1%22,%22sp4 \ u9999%22]&安培;减少=假
因为这对我来说很好看。我错过了什么?