How to load json file data to existing couchbase bucket through command line or manually?

1.7k views Asked by At

As i have created a data file in JSON format and I want to know how to load that JSON file to existing Couchbase Server bucket through command line or manually?

2

There are 2 answers

0
Matthew Groves On

There is a cbimport command line tool that ships with Couchbase Server that you can use to import JSON (or CSV) data.

Here's an example that imports a JSON "lines" file into localhost and generates a UUID key

$ cbimport json -c couchbase://localhost -u myusername -p mypassword \
 -b mybucket -d file:///data/myjson.json -f lines -g #UUID#
0
Matthew Groves On

To add it manually, you can simply copy and paste the contents into the UI.

Go to Buckets -> click "Documents" next to the bucket you want -> click "Add Document" on the top right.

First, enter whatever key you want. Next, paste the JSON contents.