Loading presentation...

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

Introduction to MongoDB

MongoDB is a NoSQL database system, an alternate for relational databases. This work introduces MongoDB and highlights its salient features
by

Elvis D'Souza

on 7 April 2011

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of Introduction to MongoDB

MongoDB Basics Highest level containers: Databases Remember Oracle/MySQL/Postgres? A database has "Collections" Sort of a table, a few differences A collection has "Documents" Yep. Rows it is A Document has "fields" Columns? Yeah! Indexes and Cursors Almost the same Why the new terminology? Multiple Updates Update All. Or just the one Operators AND OR NOT NoSQL Query Selectors The WHERE clause Updating Replace, $set and more Upserts Update; else Insert Find Data Modeling An Introduction By Elvis Joel D'Souza No Joins Denormalization Think Scale An alternate to Joins? Arrays and Embedded Documents Dealing with many-to-many cases Few or many collections A limit you have to keep in mind Transactions Oops. The DB just crashed Field Selection Ordering Paging Count When (not) to use An Alternative to Relational DBs And not a replacement Schemaless You decide the structure No SQL A natural way to talk to DBs Writes and Capped Collections About Speed, Size and Handling errors Durability Not a problem anymore Replication Multiple copies of data Full text Search Lucene/Solr is the way to go Data Processing When data goes large Performance Asynchronous Writes Sharding Replication Profiler Backup and Restore A copy, please What on earth, is happening? You WILL need this One database, many machines Please write this. Bye Indexes Search on a field, fast Welcome! Thanks! me@elvis.co.in | @elvisds image Credit : svilen001 at sxc.hu This work is derived from The Little MongoDB book by Karl Seguin | http://openmymind.net | @karlseguin { "_id" : ObjectId("4d9b0f86750d4e384b7e7680"), "name" : "Cheteshwar Arvind Pujara", "age" : 23, "teams" : [
"India",
"India A",
"India Green",
"India Under-19s",
"Kolkata Knight Riders",
"Saurashtra",
"Saurashtra Under-16s",
"Saurashtra Under-19s"
], "batting_style" : "Right-hand bat", "bowling_style" : "Legbreak" } { "_id" : ObjectId("4d9b0f99750d4e384b7e7681"), "name" : "Saurabh Sunil Tiwary", "age" : 21, "teams" : [
"India",
"Bihar",
"Bihar Under-14s",
"India Green",
"India Under-19s",
"Jharkhand",
"Mumbai Indians"
], "alias" : [ "Saurav" ], "batting_style" : "Left-hand bat" }
{ "_id" : ObjectId("4d9b0f68750d4e384b7e767f"), "name" : "Shikhar Dhawan", "age" : 25, "teams" : [
"India",
"Delhi",
"Delhi Daredevils",
"Delhi Under-16s",
"India A",
"Mumbai Indians"
], "batting_style" : "Left-hand bat" }
> db.cricketers.find({name:'Shikhar Dhawan'}) { "_id" : ObjectId("4d9b0f68750d4e384b7e767f"), "name" : "Shikhar Dhawan", "age" : 25, "teams" : [
"India",
"Delhi",
"Delhi Daredevils",
"Delhi Under-16s",
"India A",
"Mumbai Indians"
], "batting_style" : "Left-hand bat" } { "_id" : ObjectId("4d9cab4b79045818b7762f7b"), "name" : "Shikhar Dhawan", "age" : 25, "teams" : [
"India",
"Delhi",
"Delhi Daredevils",
"Delhi Under-16s",
"India A",
"Mumbai Indians"
], "batting_style" : "Left-hand bat" }
{ "_id" : ObjectId("4d9cab4b79045818b7762f7d"), "name" : "Saurabh Sunil Tiwary", "age" : 21, "teams" : [
"India",
"Bihar",
"Bihar Under-14s",
"India Green",
"India Under-19s",
"Jharkhand",
"Mumbai Indians"
], "alias" : [ "Saurav" ], "batting_style" : "Left-hand bat" }
> db.cricketers.find({$or: [{name:'Shikhar Dhawan'},{alias:'Saurav'}]}) > db.cricketers.update({'name':'Shikhar Dhawan'},{$set: {'batting_style':'Right-hand bat'}}) > db.cricketers.update({'name':'Shikhar Dhawan'},{'batting_style':'Right-hand bat'}) > db.cricketers.update({name:'Shikhar Dhawan'},{$inc:{age:1}}) > db.cricketers.update({name:'Suresh'},
{$inc:{runs:10}},true) db.cricketers.update({batting_style:'Right-hand bat'},{$inc:{'bonus':5}},false,true) db.cricketers.find({batting_style:'Right-hand bat'}) db.cricketers.find({batting_style:'Right-hand bat'}).sort({age:1}) db.cricketers.find({batting_style:'Right-hand bat'}).sort({age:-1}).limit(2).skip(1) db.cricketers.find({batting_style:'Right-hand bat'}).count() SELECT Cricketers.FirstName, Cricketers.LastName, SUM(Runs.RunAmount) AS RunsPerCricketer
FROM Cricketers JOIN Runs
ON Cricketers.CricketerID = Runs.CricketerID
GROUP BY Cricketers.FirstName, Cricketers.LastName db.cricketers =>
{ "_id" : ObjectId("4d9caac99428176465c63d6b"), "age" : 25, "batting_style" : "Right-hand bat", "name" : "Shikhar Dhawan", "teams" : [
"India",
"Delhi Daredevils",
"Mumbai Indians"
] }

db.runs =>
{ "_id" : ObjectId("573c641d6b6a428d9cac9649"), "run_amount": 1025, "cricketer_id" : ObjectId("4d9caac99428176465c63d6b") }
db.cricketers =>
{ "_id" : ObjectId("4d9caac99428176465c63d6b"),
"age" : 25, "batting_style" : "Right-hand bat",
"name" : "Shikhar Dhawan", "teams" : [
"India",
"Delhi Daredevils",
"Mumbai Indians"
], runs : { "run_amount": 1025 } } { "_id" : ObjectId("4d9caac99428176465c63d6b"), "age" : 25,
"batting_style" : "Right-hand bat", "name" : "Shikhar Dhawan",
"teams" : [
"India",
"Delhi Daredevils",
"Mumbai Indians"
]}
Full transcript