我正在使用Pouchdb和Cloudant,当我的Web应用程序启动时,它会从Cloudant复制到浏览器中的pouchdb。我知道pouchdb如何在内部工作,这就是我相信这个过程的工作方式(高级别):
问题在于步骤4,当pouch尝试将该doc写入cloudant服务器时(第一次),服务器返回'case_clause'错误。我认为问题可能是发送到cloudant的无效ID(cloudant不接受此格式的ID),因为写入服务器的doc的id是_local/799c37dfaefb3774a04f55c7f8cee947
(或其他随机数字和字符)结束)。我不知道这是否是一个有效的文档ID(对于cloudant,因为这对于pouchdb是准确的),所以我想我问,是问题(cloudant不可接受的id),还是有一些基于cloudant服务器返回的错误的其他问题。
以下是正在撰写的文件:
{ _id: "_local/799c37dfaefb3774a04f55c7f8cee947", last_seq: "63" }
以下是Chrome调试程序的完整错误输出:
{ error: "case_clause" reason: "{{case_clause,{ok,{error,[{{doc,>, {338, [>]}, {[{>,>}]}, [],false,[]}, {error,internal_server_error}}]}}}, [{fabric,update_doc,3},{chttpd_db,'-update_doc/6-fun-0-',3}]}" stack: Array[4] 0: "chttpd_db:update_doc/6" 1: "chttpd:handle_request/1" 2: "mochiweb_http:headers/5" 3: "proc_lib:init_p_do_apply/3" length: 4 __proto__: Array[0] status: 500 }
注意:当我进入cloudant的被褥并使用其id手动输入检查点文档的URL时,它不存在。
由于
编辑:
使用Chrome调试程序的上述请求中的标题信息:
Request URL:http://lessontrek.toddbluhm.c9.io/db/ilintindingreseseldropec/_local%2F799c37dfaefb3774a04f55c7f8cee947 Request Method:PUT Status Code:500 Internal Server Error Request Headersview parsed PUT /db/ilintindingreseseldropec/_local%2F799c37dfaefb3774a04f55c7f8cee947 HTTP/1.1 Host: lessontrek.toddbluhm.c9.io Connection: keep-alive Content-Length: 111 Accept: application/json Origin: http://lessontrek.toddbluhm.c9.io User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36 Content-Type: application/json Referer: http://lessontrek.toddbluhm.c9.io/app Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Cookie: connect.sid=s%3A8MVBFmbizTX4VNOqZNtIuxQI.TZ9yKRqNv0ePbTB%2FmSpJsncYszJ8qBSD5EWHzxQYIbg; AuthSession=(removed for security purposes, but valid); db_name=ilintindingreseseldropec; __utma=200306492.386329876.1368934655.1375164160.1375252679.55; __utmc=200306492; __utmz=200306492.1372711539.22.2.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); c9.live.proxy=(removed for security purposes, but valid) Request Payloadview parsed {"_id":"_local/799c37dfaefb3774a04f55c7f8cee947","last_seq":"63","_rev":"338-7db9750558e43e2076a3aa720a6de47b"} Response Headersview parsed HTTP/1.1 500 Internal Server Error x-powered-by: Express vary: Accept-Encoding x-couch-request-id: 7d2ca9fc server: CouchDB/1.0.2 (Erlang OTP/R14B) date: Wed, 31 Jul 2013 07:29:23 GMT content-type: application/json cache-control: must-revalidate content-encoding: gzip transfer-encoding: chunked via: 1.1 project-livec993c2dc8b8c.rhcloud.com (node-web-proxy/0.4) X-C9-Server: proxy_subdomain_collab-bus2_01
答案 0 :(得分:4)
与CouchDB一样,Cloudant希望所有_local转速都以“0-”开头。 pouchdb不应该生成此表单的rev值。如果您对CouchDB尝试此PUT,则会得到相同的堆栈跟踪。