150 likes | 410 Views
MongoDB. Overview Doctrine ODM Symfony2 with Doctrine ODM. MongoDB vs MySQL. MongoDB - Overview. Collection Relationships: Embedding Linking JSON (BSON) Case study: Blog Post Category. Case Study - Blog. Mysql : 4 tables + 3 references MongoDB :
E N D
MongoDB Overview Doctrine ODM Symfony2 with Doctrine ODM
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: http://wiki.vidait.vn/index.php5?title=Getting_Started_with_MongoDB • RockMongo
Doctrine ODM • Document (Entity) • DocumentManager (EntityManager) • Mapping: • @EmbedMany • @EmbedOne • @ReferenceOne • @ReferenceMany
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