Deep dive - Part 2
The basic N1QL query :
SELECT - The fields of each document to return
FROM - The data bucket in which to look
WHERE -The conditions that the document must satisfy
Data in Couchbase Server is stored in the form of documents, not row/columns
String matching can be accomplished using LIKE operator in the WHERE clause.
Example : % - Matches zero/more characters
Filter based on arrays nested inside the document.
Using ANY/EVERY - SATISFIES construct.
Example : Expression after ANY clause allows us to assign name to an element in the array that we searching through. SATIESFIES - to specify filter condition
Indexes are needed for N1QL to do its work,
At least one index define to make a bucket queryable
Create primary index
Syntax :
CREATE PRIMARY INDEX ON 'bucket-name'