N1QL DP4

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, subqueries, data manipulation language (DML), 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 cheat sheet. The online tutorial is a good way to get started and play with N1QL in an easy, fun environment. The cheat sheet 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:

  1. Expand the package archive.
  2. Open a command window and navigate to your local N1QL directory.
  3. Start N1QL by entering one of the following commands:
    # Unix command
    $ ./start_tutorial.sh
      				
    # Windows command
    $ ./start_tutorial.bat
  4. To run the tutorial, open a browser and go to http://localhost:8093/tutorial.
  5. To connect N1QL with your Couchbase Server, enter the following command:
    $ ./cbq-engine -datastore=http://[server_name]:8091/
  6. To use the command-line interactive query tool, enter the following command:
    $ ./cbq -engine=http://[couchbase-query-engine-server-name]:8093/
  7. Before issuing queries against a Couchbase bucket, run the following command from the query command line:
    $ CREATE PRIMARY INDEX ON [keyspace-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.