How can we export Couchbase Server data and use it to create a ".cblite2" Couchbase lite db

We want to take (export) existing data from our CB Server 6.0 db and use it to pre-populate a “.cblite2” Couchbase Lite db.

What is the fastest way to achieve this ? Can we use the CLI for example ? Been digging around for examples/docs but can’t find any. Appreciate some advice on this, thanks!

The fastest way is to write a desktop Couchbase Lite application, start a Sync Gateway instance that uses the CB Server instance and do a pull replication in the desktop application from the Sync Gateway instance (basically what an app would be doing).

hey borrrden, ok fair enough many thanks.

taking that suggested route (sync’ing down to a device) -> does the file then sitting on the (lets say) Android device live in the “files” directory ? And so we would then need to move it to the “assets” directory, before bundling it with the APK for distribution in the store ?

If you use a device, then yes you will need to extract it from the device (you can choose where the database lives according to your needs). My suggestion was the build a desktop application so that it is easy to get the database. After that you will need to bundle it in a way that makes sense for your platform and then extract it to a writeable location (for example, the files directory). After that you can make a database configuration that points to the same directory, and uses the same database name. It will be picked up and used as if it were created on the device that is running.

ok yes sorry i missed the desktop piece. good idea, then we can reuse it which will undoubtedly be needed (that’s a nice idea for a Couchbase provided tool actually :-). or perhaps a CLI option

@priya.rajagopal For product consideration (tool)

There is a CLI option — the cblite tool. Use the pull subcommand to pull from Sync Gateway into a local database file.