couchbase live europe 2015: bringing n1ql query to your app frameworks in java, .net & node.js

33
Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js Matt Ingenthron & Simon Baslé - Couchbase

Upload: couchbase

Post on 16-Jul-2015

157 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

Matt Ingenthron & Simon Baslé - Couchbase

Page 2: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

N1QL Primer

Page 3: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

©2015 Couchbase Inc.

N1QL Primer

3

NoSQL...

Page 4: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

©2015 Couchbase Inc.

N1QL Primer

4

NoSQLbut why not a

query language?

Page 5: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

©2015 Couchbase Inc.

N1QL Primer

5

querying on

relational data=

SQL

Page 6: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

©2015 Couchbase Inc.

N1QL Primer

6

querying on

JSON=

N1QL

Page 7: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

©2015 Couchbase Inc.

N1QL Primer

7

SELECT fname, children FROM tutorial

Page 8: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

©2015 Couchbase Inc.

N1QL Primer

8

SELECT fname, children FROM tutorial

SQL? We can do better

Page 9: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

©2015 Couchbase Inc.

N1QL Primer

9

SELECT fname, children FROM tutorialWHERE EVERY child IN tutorial.children

SATISFIES child.age > 10 END

Page 10: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

©2015 Couchbase Inc.

N1QL Primer

10

cbq-enginethe N1QL service

Page 11: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

©2015 Couchbase Inc.

N1QL Primer

11

cbq-enginethe N1QL service

standalone in DP4, to be integrated in couchbase server

Page 12: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

©2015 Couchbase Inc.

N1QL Primer

12

cbqcommand line client

Page 13: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

©2015 Couchbase Inc.

N1QL Primer

13

responses are

JSON

Page 14: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

©2015 Couchbase Inc.

N1QL Primer

14

{"results": [{"children": [{"age": 17,"fname": "Abama","gender": "m"

},{"age": 21,"fname": "Bebama","gender": "m"

}],

responses are

JSON

Page 15: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

©2015 Couchbase Inc.

N1QL Primer

15

responses have

MetaData

Page 16: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

©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

Page 17: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

Usage in the SDKs

Page 18: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

©2015 Couchbase Inc.

Usage in the SDKs

18

C / C++

Page 19: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

©2015 Couchbase Inc.

Usage in the SDKs

19

Page 20: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

©2015 Couchbase Inc.

Usage in the SDKs

20

API at the

Bucketlevel

Page 21: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

©2015 Couchbase Inc.

Usage in the SDKs

21

Statementin a

Querywith additional

Parameters

Page 22: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

©2015 Couchbase Inc.

Usage in the SDKs

22

Statements can have

Placeholders

Page 23: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

©2015 Couchbase Inc.

Usage in the SDKs

23

either

positional $1

Page 24: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

©2015 Couchbase Inc.

Usage in the SDKs

24

or

named$param

Page 25: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

©2015 Couchbase Inc.

Usage in the SDKs

25

Placeholder valuesare passed in the query's parameters

Page 26: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

©2015 Couchbase Inc.

Usage in the SDKs

26

Statements can be

Prepared

Page 27: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

©2015 Couchbase Inc.

Usage in the SDKs

27

get a QueryPlanhold to it

then execute it repeatedly

Page 28: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

©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

Page 29: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

.Net

N1QL in

Page 30: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

Node.JS

N1QL in

Page 31: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

Java

N1QL in

Page 32: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

Q&A

Page 33: Couchbase Live Europe 2015: Bringing N1QL Query to Your App Frameworks in Java, .NET & Node.js

Thank you.