Presentation is loading. Please wait.

Presentation is loading. Please wait.

javascript for your data

Similar presentations


Presentation on theme: "javascript for your data"— Presentation transcript:

1 javascript for your data

2 MongoDB Bridge the gap between key/val stores and traditional RDBMS

3 MongoDB Bridge the gap between key/val stores and traditional RDBMS

4 MongoDB the gap table

5 MongoDB the gap table → collection

6 MongoDB collection

7 MongoDB collection BSON document

8 MongoDB collection BSON document a set of fields

9 MongoDB collection BSON document a set of fields key-value pair

10 MongoDB collection BSON document a set of fields key-value pair
key: a name (string)

11 MongoDB collection BSON document a set of fields key-value pair
key: a name (string) val: any basic type string, int, float, date, binary, array, document, ...

12 MongoDB collection of BSON documents queryable

13 MongoDB the gap table → collection SQL

14 MongoDB the gap table → collection SQL → query objects

15 MongoDB Query object

16 MongoDB Query object JSON-like query representation

17 MongoDB Query object JSON-like query representation
db.users.find({ 'lastname': 'Heckmann' });

18 MongoDB Query object { 'lastname': 'Heckmann' }

19 MongoDB Query object { 'lastname': 'Heckmann' } could even be an array

20 MongoDB Query object { 'lastname': 'Heckmann' , 'body.odor': 'nasty'
, 'age': { $gt: 32 } , ... }

21 MongoDB Query object { 'lastname': 'Heckmann' , 'body.odor': 'nasty'
, 'age': { $gt: 32 } , ... }

22 MongoDB Query object { 'lastname': 'Heckmann' , 'body.odor': 'nasty'
, 'age': { $gt: 32 } , ... }

23 MongoDB Query object { 'lastname': 'Heckmann' , 'body.odor': 'nasty'
, 'age': { $gt: 32, $lt: 65 } , ... }

24 Query object MongoDB $gt $lt $ne $in $nin $all $not $size $exists
… more

25 MongoDB Query object RegExp too!

26 MongoDB Query object RegExp too
db.users.find({ 'lastname': /eckmann$/i });

27 MongoDB Query object Subsets
db.users.find({ 'lastname': /eckmann$/i }, { 'age': true });

28 MongoDB Query object db.users .find({ 'lastname': /eckmann$/i })
.sort({ 'lastname': -1 }) .limit(10) .skip(10*(pageNumber - 1)) ;

29 MongoDB Query object db.users .find({ 'lastname': /eckmann$/i })
.sort({ 'lastname': -1 }) ← descending .limit(10) .skip(10*(pageNumber - 1)) ;

30 MongoDB Query object db.users .find({ 'lastname': /eckmann$/i })
.count() ;

31 MongoDB no JOINs

32 MongoDB no JOINs less normalization

33 MongoDB no JOINs less normalization embedded documents

34 MongoDB embedded documents

35 embedded documents MongoDB { name: 'aaron' , scores:
[ { total: 93, class: ObjectID } , { total: 46, class: ObjectID } , { total: 20, class: ObjectID } ] }

36 embedded documents MongoDB { name: 'aaron' , scores:
[ { total: 93, class: ObjectID } , { total: 46, class: ObjectID } , { total: 20, class: ObjectID } ] } think foreign keys

37 embedded documents MongoDB { name: 'aaron' , scores:
[ { total: 93, class: ObjectID } , { total: 46, class: ObjectID } , { total: 20, class: ObjectID } ] } { _id: ObjectID , name: 'how to be a good neighbor' , teacher: 'mr rogers' }

38 MongoDB ObjectID unique identifier of a document each document has one
auto inserted if missing

39 Insertion and Updation
MongoDB Insertion and Updation

40 MongoDB

41 cheesy

42 Atomic Operations

43 MongoDB $set $unset $inc $push $pushAll $pop $pull $pullAll $addToSet
Atomic Ops $set $unset $inc $push $pushAll $pop $pull $pullAll $addToSet $rename

44 MongoDB Indexing

45 MongoDB Indexing any property into embedded documents into arrays

46 MongoDB Indexing db.users.ensureIndex({ lastname: 1 })
db.users.ensureIndex({ 'body.odor': 1 }) db.users.ensureIndex({ 'body.odor': 1, age: 1 })

47 MongoDB HTTP Interface

48 MongoDB HTTP Interface http://localhost:28017/

49 MongoDB Document oriented Schema-less Rich queries Full index support
Atomic operations MapReduce Auto-sharding / replication / GridFS

50 MongoDB Mongoose

51 Thank You http://www.mongodb.org https://github.com/mongodb
loyments


Download ppt "javascript for your data"

Similar presentations


Ads by Google