I am using a shell script to configure Couchbase in a docker container. I am able to use cbimport to successfully import data into non-default scopes and collections using the --format list
command, where the test data is in a json list format. I would like to do this using the --format sample
command with the test data in a zip file with the specified sample format.
This is the successful cbimport command when using test data in the list format:
cbimport json --cluster localhost:8091 \
--username Administrator \
--password password \
--bucket connectedroom \
--dataset file:///opt/testdata/couchbase-setup.json \
--format list \
--generate-key %type%::%propCode%::%roomNumber%::%macAddress%::%date% \
--scope-collection-exp ecmp.%type%
This is successful but I would like to place the data into a non-default scope and collections using the sample format the same way I am doing it using the list format.
cbimport json --cluster localhost:8091 \
--username Administrator \
--password password \
--bucket connectedroom \
--dataset file:///opt/testdata/connectedroom.zip \
--format sample \
--generate-key %type%::%propCode%::%roomNumber%::%macAddress%::%date% \
--scope-collection-exp ecmp.%type%
but it doesn’t seem to be supported in the way I’m specifying:
2023-02-21 11:32:24 SUCCESS: Bucket created
2023-02-21 11:32:24 SUCCESS: Scope created
2023-02-21 11:32:24 SUCCESS: Collection created
2023-02-21 11:32:25 SUCCESS: Collection created
2023-02-21 11:32:40 JSON import failed: the 'sample' format does not support using the '--generate-key' argument
2023-02-21 11:32:40 /entrypoint.sh couchbase-server
Remove the generate-key
argument which is optional for --format sample
:
cbimport json --cluster localhost:8091 \
--username Administrator \
--password password \
--bucket connectedroom \
--dataset file:///opt/testdata/connectedroom.zip \
--format sample \
--scope-collection-exp ecmp.%type%
2023-02-21 11:35:32 SUCCESS: Bucket created
2023-02-21 11:35:32 SUCCESS: Scope created
2023-02-21 11:35:32 SUCCESS: Collection created
2023-02-21 11:35:33 SUCCESS: Collection created
2023-02-21 11:35:48 JSON import failed: the 'sample' format does not support using the '--scope-collection-exp' argument
2023-02-21 11:35:48 /entrypoint.sh couchbase-server
Remove the --scope-collection-exp
argument:
cbimport json --cluster localhost:8091 \
--username Administrator \
--password password \
--bucket connectedroom \
--dataset file:///opt/testdata/connectedroom.zip \
--format sample \
2023-02-21 11:47:44 JSON `file:///opt/testdata/connectedroom.zip` imported to `localhost:8091` successfully
2023-02-21 11:47:44 Documents imported: 3 Documents failed: 0
2023-02-21 11:47:44 /entrypoint.sh couchbase-server
This last command is successful but it doesn’t use the scope and collections I create. I would like to replicate my initial cbimport command using --format list
to use --format sample
. Is this possible?