1

I have a list of items (about 500 items) by category, to add into couchDB database and I cannot find any answers online, neither do I know how to do it, may I know any kind soul knows it or have done it before??

Pineapple
  • 13
  • 4

2 Answers2

0

Does CouchDb have an import function? A csv file of some type for example - never had CouchDB so don’t know, but most DB programs have an import facility.

Have you checked the help on CouchDB : it will give examples of acceptable file types as well as examples of methods.

A quick search gave this page where the import method is described - I did not check other results to find out if there is something more recent.

But you may find useful answers already on Stack, such as : import json file to couch db-

Solar Mike
  • 7,156
  • 4
  • 17
  • 32
0

While CouchDB can hold data of any structure as JSON documents, your data in excel is a two-dimensional array. The conversion from Excel to CouchDB is simple:

  1. Make sure your spreadsheet is pure 2d array, with one single header row with the field names you want to use as property names in the JSON document. If your data are grouped in catagories, just make sure the catetory is a field along with the other field/property names
  2. Export your data from Excel (or any spreadsheet) in csv format
  3. Use a csv to json conversion tool to create an array of JSON documents, one row in the spreadsheet becomes one document in CouchDB
  4. Post the array of documents to CouchDB

Point 2-3 can be replaced by a cut & paste operation using a tool like https://www.csvjson.com/csv2json

More about the CSV format: https://en.wikipedia.org/wiki/Comma-separated_values
How to save an array of documents to CouchDB: http://docs.couchdb.org/en/latest/api/database/bulk-api.html#db-bulk-docs

Johs
  • 441
  • 4
  • 7