couchbaselabs / vscode-cblite

Apache License 2.0
11 stars 6 forks source link

Couchbase Lite for VSCode

This is a Visual Studio Code extension for interacting with a Couchbase Lite database. Couchbase Lite is full featured NoSQL JSON document database for mobile, desktop and embedded platforms. This extension includes support for enumerating documents and running ad-hoc queries. This plugin is heavily inspired by the SQLite extension that provides similar functionality. Some icons used in the product were downloaded from IconScout via the free license.

Quick Tour

Open a Database

This can be accomplished in a few different ways.

Open Database With Right Click Open Database With Command Pallete

:warning: Opening a database using this plugin will automatically upgrade it to 3.0 version of Couchbase Lite silently. If this is undesirable, make a copy of the database folder before opening it with the plugin.

Interact With Documents

Once you have opened a database, you can browse its contents in the CBLite Explorer pane that appears on the left hand side of Visual Studio Code:

Browse through Database Documents

If you want to retrieve the contents of a given document, you can right click it and choose Get Document

Retrieve Document From Database

Now notice the status bar shows that you are currently working in the context of the document you opened:

cblite Status Bar Context

You can now make changes and save back to the database by using the Update Document command:

Save Document To Database

Querying

By default only SQL++ (aka N1QL) commands are enabled, and so only those will be covered here. Beware of dragons if you enable JSON queries.

To run a query, right click on an opened database and select New SQL++ Query. That will open a new document editor in which you can run your query and get the results:

Run a Query

Create Document

To create a document, create a file of type "json" and add the JSON document contents. Then select Create New Document from the command palette to add the document to the database.

Create a document

Building

git clone https://github.com/couchbaselabs/vscode-cblite

Debug, for local testing

Release, for packaging

Note: if you've built a debug build you will need to erase the build/ directory first.

Use as node.js Binding

The repo can also be used as a standalone node.js binding for Couchbase Lite for C.

For this,