Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CouchDB导入JSON文件_Json_Couchdb - Fatal编程技术网

CouchDB导入JSON文件

CouchDB导入JSON文件,json,couchdb,Json,Couchdb,我尝试使用 我希望每个组(邮政编码,城市,液化天然气,拉丁美洲)作为一个文件 添加数据库be_cities并使用此命令导入couchdb: curl -X POST http://user:password&@192.168.0.205:5984/be_cities/_bulk_docs -H "Content-type: application/json" -d @zipcodes-belgium.json 但给出了一个错误: [1] 13218 -bash: @19

我尝试使用

我希望每个组(邮政编码,城市,液化天然气,拉丁美洲)作为一个文件

添加数据库be_cities并使用此命令导入couchdb:

curl -X POST http://user:password&@192.168.0.205:5984/be_cities/_bulk_docs -H "Content-type: application/json" -d @zipcodes-belgium.json
但给出了一个错误:

    [1] 13218
    -bash: @192.168.0.205:5984/be_cities/_bulk_docs: No such file or directory
ubuntu@ubuntu$curl: (3) Port number ended with 'F'
用PUT代替POST也可以尝试,但也有一个错误

有人知道如何批量导入整个json文件作为文档吗?

我的问题解决了

我所做的:

  • 在JSON文件中添加文档

    {"docs": [
    ...
    ]}
    
  • 然后:


    问题是你需要引用你的URL<代码>&被bash解释为特殊,并将您的命令一分为二。Hi@Flimzy感谢您的回答。它现在工作得很好,我很高兴你让它工作了!有效载荷与问题中的错误完全无关。您不再出现该错误的唯一原因是您更改了curl命令。@Flimzy o好的,谢谢您提供的有用信息。很高兴知道。我是CouchDB的新手。这是一个很棒的数据库,但它是另一种与SQL(MySQL)相反的“思维方式”。
    {"docs": [
    ...
    ]}
    
    $curl -X POST http://192.168.0.205:5984/be_cities/_bulk_docs -H "Content-type: application/json" -d @zipcodes-belgium.json