Cbimport for specific scopes and collections

I want to import a CSV file into a specific scope and collection within a bucket, in CB 7.0 enterprise using cbimport. The command shown in the Web UI is limited to specifying the bucket using the -b flag.
Is there any way I could import to a specific collection only(except _default) using cbimport? I’m looking for the cbimport equivalent of importing using the Web UI where scope and collection are specified.


You can supply the --scope-collection-exp flag to cbimport to import to a specific collection, the flag accepts a collection string of the format ‘scope_name.collection_name’.

For example, given the following csv file ‘people.csv’:


You can import it into my_scope.my_collection in my_bucket using the following command:

/opt/couchbase/bin/cbimport csv -g %fname% -d file://people.csv -c -u Administrator -p password -b my_bucket --scope-collection-exp 'my_scope.my_collection'

Kind regards,


1 Like

Thanks a lot @Asad !
I was earlier referring to these 6.6 docs, which had this flag only for JSON, not CSV. The new 7.0-beta docs now have this example.

1 Like