N1QL

Welcome to the N1QL (pronounced "Nickel") corner! We're excited to introduce N1QL - our next generation query language. N1QL presents easy and familiar abstractions to quickly develop scalable applications that work with next generation database systems. It allows for joins, filter expressions, aggregate expressions and many other features to build a rich application. Go ahead and give N1QL a spin today by trying out the online tutorial or downloading N1QL for Couchbase Server.

Tutorial

N1QL has an interactive online tutorial and a N1QL cheatsheet. The online tutorial is a good way to get started and play with N1QL in an easy, fun environment. The cheatsheet is a quick glance and easy reference of the N1QL syntax. For more information, see:

Download N1QL

To get started, navigate to the downloads page and download N1QL.

To run N1QL on your local system:


Step 1:  Expand the package archive.
Step 2:  On the command line, navigate to your local N1QL directory.
Step 3:  Run ./start_tutorial.sh (Unix)
             ./start_tutorial.bat (Windows)
Step 4:  Open http://localhost:8093/tutorial in your browser 
         to use the tutorial on your local server.
         
         To connect N1QL with your Couchbase Server:
             ./cbq-engine -couchbase http://[server_name]:8091/

         To use the command-line interactive query tool:
             ./cbq-engine=http://[couchbase-query-engine-server-name]:8093/
   
Step 5: Before issuing queries against a Couchbase bucket, 
   run the following command from the query command line:

   CREATE PRIMARY INDEX ON [bucket-name]
   

Documentation

The N1QL documentation provides detailed information including syntax, semantics, and example code. For more information, see:

Blogs and forums

Couchbase blogs and forums have a dedicated area for N1QL topics. The forum allows you to interact directly with the N1QL engineering team. For more information, see:

Webinar

The following webinar provides a video for N1QL ad-hoc querying including the basics of the query language, use cases, and a hands-on demo that shows how N1QL can be used in sample e-commerce and social gaming applications.