Upload
couchbase
View
157
Download
5
Embed Size (px)
Citation preview
Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js
Matt Ingenthron & Simon Baslé - Couchbase
N1QL Primer
©2015 Couchbase Inc.
N1QL Primer
3
NoSQL...
©2015 Couchbase Inc.
N1QL Primer
4
NoSQLbut why not a
query language?
©2015 Couchbase Inc.
N1QL Primer
5
querying on
relational data=
SQL
©2015 Couchbase Inc.
N1QL Primer
6
querying on
JSON=
N1QL
©2015 Couchbase Inc.
N1QL Primer
7
SELECT fname, children FROM tutorial
©2015 Couchbase Inc.
N1QL Primer
8
SELECT fname, children FROM tutorial
SQL? We can do better
©2015 Couchbase Inc.
N1QL Primer
9
SELECT fname, children FROM tutorialWHERE EVERY child IN tutorial.children
SATISFIES child.age > 10 END
©2015 Couchbase Inc.
N1QL Primer
10
cbq-enginethe N1QL service
©2015 Couchbase Inc.
N1QL Primer
11
cbq-enginethe N1QL service
standalone in DP4, to be integrated in couchbase server
©2015 Couchbase Inc.
N1QL Primer
12
cbqcommand line client
©2015 Couchbase Inc.
N1QL Primer
13
responses are
JSON
©2015 Couchbase Inc.
N1QL Primer
14
{"results": [{"children": [{"age": 17,"fname": "Abama","gender": "m"
},{"age": 21,"fname": "Bebama","gender": "m"
}],
responses are
JSON
©2015 Couchbase Inc.
N1QL Primer
15
responses have
MetaData
©2015 Couchbase Inc.
N1QL Primer
16
"requestID": "19bb1a64-633a"signature": {
"Greeting": "string"},"results": [ {"Greeting": "Hello World""status": "success","metrics": {
"elapsedTime": "7.48ms","executionTime": "6.8ms","resultCount": 1,"resultSize": 49
}}
responses have
MetaData
Usage in the SDKs
©2015 Couchbase Inc.
Usage in the SDKs
18
C / C++
©2015 Couchbase Inc.
Usage in the SDKs
19
©2015 Couchbase Inc.
Usage in the SDKs
20
API at the
Bucketlevel
©2015 Couchbase Inc.
Usage in the SDKs
21
Statementin a
Querywith additional
Parameters
©2015 Couchbase Inc.
Usage in the SDKs
22
Statements can have
Placeholders
©2015 Couchbase Inc.
Usage in the SDKs
23
either
positional $1
©2015 Couchbase Inc.
Usage in the SDKs
24
or
named$param
©2015 Couchbase Inc.
Usage in the SDKs
25
Placeholder valuesare passed in the query's parameters
©2015 Couchbase Inc.
Usage in the SDKs
26
Statements can be
Prepared
©2015 Couchbase Inc.
Usage in the SDKs
27
get a QueryPlanhold to it
then execute it repeatedly
©2015 Couchbase Inc. ‹#›
Try it yourself?
Connect to “linksys18871” with “couchbase123”
Head to http://192.168.1.149/ to follow along with .NET, Node or Java
.Net
N1QL in
Node.JS
N1QL in
Java
N1QL in
Q&A
Thank you.