In the previous chapter, you learned how to fetch documents using the MapReduce functionalities of views. Therein, you need to create a view before querying for any documents when not using a document ID. Couchbase has developed an efficient way of retrieving documents using a SQL-like syntax, called N1QL. N1QL is simpler and easier to understand. The syntax is more or less like that of SQL, so developers who are from RDBMS's SQL background will find themselves very much at home.
This method makes it easier to retrieve information from Couchbase. The main difference between SQL and N1QL (pronounced as Nickel) is that N1QL provides a way to query the JSON based document-oriented database, Couchbase. N1QL offers a data definition language (DDL), a data manipulation language (DML), and queries to extract information in Couchbase.
In this chapter, we will see how to set up N1QL to fetch data from a bucket using SQL-like syntax, and then discuss...