CouchDB导入JSON文件

时间:2019-12-28 20:34:53

标签: json couchdb

我尝试使用zipcodes

导入JSON文件
[
  {
    "zip": "1000",
    "city": "Bruxelles",
    "lng": 4.351697,
    "lat": 50.8465573
  },
  {
    "zip": "1020",
    "city": "Laeken",
    "lng": 4.3487134,
    "lat": 50.883392
  },
  ...
  {
    "zip": "9992",
    "city": "Middelburg",
    "lng": 3.4071425562584,
    "lat": 51.25583235
  }
]

我希望每个组(邮政编码,城市,lng,纬度)都作为文档。

添加数据库be_cities并使用此命令将其导入到ouchdb:

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文件作为文档批量导入吗?

1 个答案:

答案 0 :(得分:-1)

我的问题解决了!

我做了什么:

  1. 在JSON文件中添加 docs

    Settings -> Keymap
    

然后:

Users don’t have to expose the Samba port, and therefore do not experience issues related to IT firewall or the drive-sharing policy.
There is no need to provide user credentials to Docker Desktop. File access rights are automatically enforced when accessing mounted folders through containers.