将多个文档上载到beddb导致错误 [英] Uploading multiple documents to couchdb giving error
本文介绍了将多个文档上载到beddb导致错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我必须将批量文档
上传到ouchdb,但这无法正常工作并出现错误。这就是我尝试使用curl
I have to upload bulk document
into couchdb but this is not working and giving error. This is what i try to do with curl
curl -d '{"docs":[{"key":"baz","name":"bazzel"},{"key":"bar","name":"barry"}]}' -X POST http://127.0.0.1:5984/testdb/_bulk_docs
这是此错误
{"error":"bad_content_type","reason":"Content-Type must be application/json"}
此curl命令是来自ouchdb Wiki的简单复制+粘贴操作,因此理想情况下,这不应给出错误。我缺少什么吗?
This curl command is simple copy+paste from wiki of couchdb so ideally this should not be giving error. Is there anything that i am missing?
推荐答案
将Header Content-Type application / json添加到curl命令中。标志是 -H
Add the Header Content-Type application/json to your curl command. The flag is -H
例如
curl -H'内容类型:application / json'-d'{ docs:[{ key: baz, name: bazzel},{ key: bar, name: barry}]}'-X POST http://127.0.0.1:5984/testdb/_bulk_docs
这篇关于将多个文档上载到beddb导致错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文