MongoDB Intro
What is MongoDB?
▪ It’s a no-sql database.
▪ Document Oriented
▪ Data stored as BSON
Where you should use MongoDB
▪ If your application is write intensive: MongoDB has
super-fast writes.
– You can use capped...
Where you should use
MongoDB(cont)

▪ No migrations required in MongoDB
▪ In built support for sharding.
▪ Support for man...
Faster writes
▪ Fan-out newsfeed
Faster writes
▪ Fan-out newsfeed.
▪ Foursquare does ~80 checkins/sec(1).
▪ Gotchas
– Lock at database level
▪

(1) https:/...
Faster writes
▪ Fan-out newsfeed.
▪ Foursquare does ~80 checkins/sec(1).
▪ Gotchas
– Lock at database level
▪

(1) https:/...
Capped collection for logging
▪ Collection == table
▪ Can be time based or size based
geo-spatial indexes
▪ Place your Domino’s order to the nearest outlet?
geo-spatial indexes
▪ db.collection('places').find(
{loc: {$near: [50,50], $maxDistance: 10}}).
Flexible schema
"_id" : ObjectId("526a55f14162689cbc0c0000"),
"first_name" : "First Name 0",
"last_name" : "last Name 0",
...
Flexible schema
▪ In mySQL, extra space for “is_external” as “nil” for
most of the rows which leads to the wastage of
spac...
No migration
▪ Migrations are expensive and time consuming. It
increase proportionally to the size of your table

▪ How do...
Sharding support

Source: http://www.slideshare.net/mdirolf/introduction-to-mongodb
In-built support for sharding.
Upcoming SlideShare
Loading in …5
×

Mongo db intro new

375 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
375
On SlideShare
0
From Embeds
0
Number of Embeds
9
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Mongo db intro new

  1. 1. MongoDB Intro
  2. 2. What is MongoDB? ▪ It’s a no-sql database. ▪ Document Oriented ▪ Data stored as BSON
  3. 3. Where you should use MongoDB ▪ If your application is write intensive: MongoDB has super-fast writes. – You can use capped collection for logging as well ▪ In built support for geo-spatial indexes. ▪ When the schema is not carved in stone. Really helpful in Agile development.
  4. 4. Where you should use MongoDB(cont) ▪ No migrations required in MongoDB ▪ In built support for sharding. ▪ Support for many languages
  5. 5. Faster writes ▪ Fan-out newsfeed
  6. 6. Faster writes ▪ Fan-out newsfeed. ▪ Foursquare does ~80 checkins/sec(1). ▪ Gotchas – Lock at database level ▪ (1) https://docs.google.com/presentation/d/1q4R3F0AnWN-MQZqbysZ92nZ4_OC7bRzUCWfbmeHHcQQ/pub?start=false&loop=false&delayms=3000&pli=1#slide=id.ga365b3_0_5
  7. 7. Faster writes ▪ Fan-out newsfeed. ▪ Foursquare does ~80 checkins/sec(1). ▪ Gotchas – Lock at database level ▪ (1) https://docs.google.com/presentation/d/1q4R3F0AnWN-MQZqbysZ92nZ4_OC7bRzUCWfbmeHHcQQ/pub?start=false&loop=false&delayms=3000&pli=1#slide=id.ga365b3_0_5
  8. 8. Capped collection for logging ▪ Collection == table ▪ Can be time based or size based
  9. 9. geo-spatial indexes ▪ Place your Domino’s order to the nearest outlet?
  10. 10. geo-spatial indexes ▪ db.collection('places').find( {loc: {$near: [50,50], $maxDistance: 10}}).
  11. 11. Flexible schema "_id" : ObjectId("526a55f14162689cbc0c0000"), "first_name" : "First Name 0", "last_name" : "last Name 0", "add" : "Address number is 0", "company" : "company 0", "employee_id" : "0" "_id" : ObjectId("526a55f14162689cbc0c0001"), "first_name" : "First Name 1", "last_name" : "last Name 1", "add" : "Address number is 1", "company" : "company 1", "employee_id" : “1“, “is_external” : “true”
  12. 12. Flexible schema ▪ In mySQL, extra space for “is_external” as “nil” for most of the rows which leads to the wastage of space. ▪ No need for the migration
  13. 13. No migration ▪ Migrations are expensive and time consuming. It increase proportionally to the size of your table ▪ How does a migration happen – Create a temp copy of the table with the migration – Delete the old table – Make temp copy permanent
  14. 14. Sharding support Source: http://www.slideshare.net/mdirolf/introduction-to-mongodb
  15. 15. In-built support for sharding.

×