MongoDB - Overview - Doctrine ODM - Symfony2 with Doctrine ODM
MongoDB vs MySQL MySQLMongoDB Termsdatabase tablescollection rowdocument QuerySELECTfind INSERTinsert …… Operator>$gt <=$lte DataTypeSame String (json/serialized)Mixed
MongoDB - Overview Collection Relationships: ◦ Embedding ◦ Linking JSON (BSON) Case study: ◦ Blog ◦ Post ◦ Category
Case Study - Blog Mysql: ◦ 4 tables + 3 references MongoDB: ◦ Case 1: 3 collections (2 linkings) Blog Post Category ◦ Case 2: 2 collections (1 embeded + 1 linking) Blog Post Category
Case 1 – All linking Pros ◦ Same as SQL ◦ Easy to setup Cons ◦ Slow ◦ Query same as SQL ◦ It’s not a NonSQL
Case 2 – Embed & Link Pros ◦ Fast ◦ NonSQL query Cons ◦ Hard to setup
MongoDB - Installation Installation: ng_Started_with_MongoDB ng_Started_with_MongoDB RockMongo
Doctrine ODM Document (Entity) DocumentManager (EntityManager) Mapping:
Doctrine ODM – Query Builder Repository QueryBuilder
Doctrine ODM – Symfony DoctrineMongoDBBundle doctrine_mongodb: connections: default: server: mongodb://localhost:27017 options: connect: true default_database: test_database document_managers: default: auto_mapping: true