12
MongoDB Open Source document database Often refered to as NoSQL

Bi presentation

Embed Size (px)

DESCRIPTION

Basics getting started with mongo

Citation preview

Page 1: Bi presentation

MongoDB

Open Source document databaseOften refered to as NoSQL

Page 2: Bi presentation

JSON style Documents

{name: ‘stephen ward’, gender:’male’ , dob:’Nov. 12 ,1958’ , maritalStatus: ‘married’}

Page 3: Bi presentation

Or Compound Doc

{name: ‘stephen ward’, gender:’male’ , dob:’Nov. 12 ,1958’ , maritalStatus: ‘married’,skills:{mongoDB:’true’, javascript:’true’,SQL:’true’,COBOL:’false’}}

Page 4: Bi presentation

UM what was that

Yes if your a SQL DBA you just said WooooBecause you would have had to create a separate table called skills and do a JOIN .MongoDB does not have joins.So how you think of your SCHEMA will be completely different.

Page 5: Bi presentation

Simple ?

Page 6: Bi presentation

What took place

• There was no database named bigroup if there was then if would have switched to it. If there wasn’t if would still have said switched , but it would just create a new db of that name

• Therefore be carefull • Using the shell I can do some javascript like

calls.

Page 7: Bi presentation

How about a little update

Page 8: Bi presentation

The update

• You’ll notice if I dont have an _id object then mongo makes the unique index for me.

• Save will insert if no unique index found or update if a unique index is found.

Page 9: Bi presentation

Add a sub-doc

Page 10: Bi presentation

Return partial

• Only want a subset of the collection

Page 11: Bi presentation

Like

Page 12: Bi presentation

OK lets have a little fun

• Node.js • Express• Mongojs