How to Upload/import 20000 elements/row into couchbase

I have a Json file with 20000 elements but in the following format:
[
{
“CustomerId”: 1001,
“FirstName”: “Cody”,
“LastName”: “Carrillo”,
“Email”: "volutpat.Nulla@antebibendumullamcorper.net",
“Password”: “ESC60OSJ7UY”,
“Phone”: “1-823-999-1958”,
“Street”: “828-8413 Aliquet, St.”,
“City”: “Torrejón de Ardoz”,
“State”: “Madrid”,
“Zipcode”: “9407PT”,
“Country”: “Sint Maarten”,
“DOB”: “Jul 2, 1961”
},
{
“CustomerId”: 1002,
“FirstName”: “Amber”,
“LastName”: “Browning”,
“Email”: "mi@mollisIntegertincidunt.org",
“Password”: “OKS28VPB2LH”,
“Phone”: “1-357-328-1853”,
“Street”: “9717 Ante Road”,
“City”: “Katowice”,
“State”: “SL”,
“Zipcode”: “617009”,
“Country”: “Kiribati”,
“DOB”: “Jan 18, 1994”
}]

When I am uploading it using cbdocloader, it uploads the following in the bucket as a single row with each {section} as a row cell.
How can I upload it as two different rows in the bucket?

If you want to checkout the Developer Preview of Couchbase 4.6 there’s a new cbimport tool.

1 Like

If you have loaded as a single doc (array of objects), you can UNNEST and INSERT into the bucket.

INSERT INTO mybucket(KEY UUID(), VALUE v)
    SELECT newdoc 
    FROM mybucket USE KEYS "fulldata--REPLACETHIS--"
                   UNNEST mybucket as newdoc;
1 Like