2. What is MongoDB?
▪ It’s a no-sql database.
▪ Document Oriented
▪ Data stored as BSON
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. Where you should use
MongoDB(cont)
▪ No migrations required in MongoDB
▪ In built support for sharding.
▪ Support for many languages
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. 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. 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