gpt4 book ai didi

javascript - CouchApp View 显示为空结果

转载 作者:行者123 更新时间:2023-11-29 22:31:28 26 4
gpt4 key购买 nike

我是 CouchDB 的新手,但我尝试用 Google 搜索却一无所获。

我有一个 View ,当从数据库查看时,它有一个包含 2 个文档的结果集主机:5984/_utils/database.html?phistory/_design/phistory/_view/res

当我尝试通过沙发应用程序访问同一 View 时,返回的结果为空文档。主机:5984/phistory/_design/phistory/_view/res

从 CouchApp 查看时的结果 JSON:

{"rows":[
{"key":null,"value":null}
]}

这是 View 中的 map 函数。

function(doc) {
if(doc.query && doc.transactions){
emit(doc.query, doc.transactions);
}
}

文档

{
"_id": "fad95bf61bd2c87db4d017668a002191",
"_rev": "1-8bec74cf8022f91bdc9cb53fa8ff7599",
"query_group": "simple-select",
"query": "select id from FactV__c",
"transactions": {
"2011-06-01T12:13:15Z": "100",
"2011-07-01T12:13:15Z": "099"
}
}

据此看来我正在正确访问 View 。 http://wiki.apache.org/couchdb/HTTP_view_API

从沙发日志中为请求添加调试输出。您可以在下面看到,实际 View 从 DB Angular 呈现数据,但将 null 返回给浏览器的响应。

[Wed, 13 Jul 2011 18:36:09 GMT] [debug] [<0.957.0>] 'GET'/phistory/_design/phistory/_view/res {1,1} header :[{'Accept',"text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8"}, {'接受字符集',"ISO-8859-1,utf-8;q=0.7,*;q=0.3"}, {'接受编码',"gzip,deflate,sdch"}, {'接受语言',"en-US,en;q=0.8"}, {'连接',“保持事件”}, {'Cookie',"AuthSession=YnVpbGQ6NEUxREUzNTk6suAhrCjMRNN100LLDJqb0Dl-0Ag"}, {'主机',"cmarcel-ws:5984"}, {'If-None-Match',"\"5WLSLFYCQ880T9JCCPAMD804R\""}, {'User-Agent',"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30"}, {“X-Purpose”,“:预览”}]

[2011 年 7 月 13 日星期三 18:36:09 GMT] [调试] [<0.957.0>] cookie 成功验证为:“构建”

[Wed, 13 Jul 2011 18:36:09 GMT] [debug] [<0.957.0>] request_group {Pid, Seq} {<0.907.0>,96}

[Wed, 13 Jul 2011 18:36:09 GMT] [debug] [<0.957.0>] request_group {Pid, Seq} {<0.907.0>,96}

[Wed, 13 Jul 2011 18:36:09 GMT] [debug] [<0.918.0>] OS Process #Port<0.2202> Input::["reset",{"reduce_limit":true}]

[Wed, 13 Jul 2011 18:36:09 GMT] [debug] [<0.918.0>] OS Process #Port<0.2202> Output::true

[Wed, 13 Jul 2011 18:36:09 GMT] [debug] [<0.918.0>] OS Process #Port<0.2202> Input::["reduce",["function(keys, values, rereduce ) {\n\n}"],[[["从 FactV__c 中选择 id","fad95bf61bd2c87db4d017668a002191"],{"2011-06-01T12:13:15Z":"100","2011-07-01T12:13 :15Z":"099"}]]]

[Wed, 13 Jul 2011 18:36:09 GMT] [debug] [<0.918.0>] OS Process #Port<0.2202> Output::[true,[null]]

[Wed, 13 Jul 2011 18:36:09 GMT] [info] [<0.957.0>] 10.0.63.48 - - 'GET'/phistory/_design/phistory/_view/res 200

最佳答案

所以我弄清楚发生了什么事。显然,当您通过 couchapp 生成 View 时,它也会创建并清空 reduce 函数。它被褥,你需要明确地运行减少,所以它不会影响结果集。通过应用程序,空的 reduce 有效地消除了结果。感谢所有回复的人。

关于javascript - CouchApp View 显示为空结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6672135/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com