-1

I try import a JSON file with zipcodes

[
  {
    "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
  }
]

I want every group (zip, city, lng,lat) as a document.

Adding the database be_cities and using this command for import to 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

But gives an error:

    [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'

Try it also with PUT instead of POST, but also an error.

Someone knows how importing in bulk this whole json-file as documents?

Tuxy
  • 91
  • 10

1 Answers1

-1

My problem is solved!

What i did:

  1. adding docs in the JSON-file

    {"docs": [
    ...
    ]}
    

Then:

$curl -X POST http://192.168.0.205:5984/be_cities/_bulk_docs -H "Content-type: application/json" -d @zipcodes-belgium.json
Tuxy
  • 91
  • 10
  • The payload is completely unrelated to the error in your question. The only reason you no longer get that error is because you changed the curl command. – Jonathan Hall Dec 28 '19 at 23:42
  • @Flimzy o okay, thanks for the useful info. Good to know. I'm new with CouchDB. It's an awesome database, but it's an other way 'thinking' opposite SQL (MySQL). – Tuxy Dec 29 '19 at 07:47