CBQcbq is the command-line REPL environment for N1QL and, since version 4.0, it comes along with Couchbase Server.

It's a great tool to not only learn N1QL but also to try out and optimise queries before using them in your application.

Depending on your operating system, and how you've installed Couchbase, the location of cbq can vary. Here's a quick reference for finding cbq on your machine.

Mac OS X

/Applications/Couchbase Server.app/Contents/Resources/couchbase-core/bin/cbq

Windows

C:Program FilesCouchbaseServerbin

Linux

/opt/couchbase/bin/cbq

GUI tool: Query Workbench

If you find cbq useful for experimenting with N1QL, Query Workbench is where you're more likely to spend your time building and refining your queries. It provides a GUI environment with several coveniences, such as query autocompletion, an overview of the index status of your buckets and your results on-screen at the same time as the query itself. It's in developer preview now for Mac, Linux and Windows.

Download Query Workbench from the Couchbase downloads page Tools tab and then follow the guide.

Author

Posted by Matthew Revell, Lead Developer Advocate, EMEA, Couchbase

Matthew Revell is a Lead Dev Advocate, EMEA Couchbase. He developed a global strategy for putting Couchbase front in the minds of the product's developers.

One Comment

Leave a reply