Upload
stephen-ward
View
129
Download
1
Embed Size (px)
DESCRIPTION
Basics getting started with mongo
Citation preview
MongoDB
Open Source document databaseOften refered to as NoSQL
JSON style Documents
{name: ‘stephen ward’, gender:’male’ , dob:’Nov. 12 ,1958’ , maritalStatus: ‘married’}
Or Compound Doc
{name: ‘stephen ward’, gender:’male’ , dob:’Nov. 12 ,1958’ , maritalStatus: ‘married’,skills:{mongoDB:’true’, javascript:’true’,SQL:’true’,COBOL:’false’}}
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.
Simple ?
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.
How about a little update
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.
Add a sub-doc
Return partial
• Only want a subset of the collection
Like
OK lets have a little fun
• Node.js • Express• Mongojs