mongodb 101
TRANSCRIPT
![Page 1: MongoDB 101](https://reader037.vdocuments.pub/reader037/viewer/2022100104/58e90abd1a28abc7598b5e41/html5/thumbnails/1.jpg)
MONGODB 101Introduction to document database
PHPers.0215 lipca 2013
Leszek Krupiński@leafnode
![Page 2: MongoDB 101](https://reader037.vdocuments.pub/reader037/viewer/2022100104/58e90abd1a28abc7598b5e41/html5/thumbnails/2.jpg)
BASICSNoSQL and document databases
![Page 3: MongoDB 101](https://reader037.vdocuments.pub/reader037/viewer/2022100104/58e90abd1a28abc7598b5e41/html5/thumbnails/3.jpg)
MONGODBDocument database, object store
![Page 4: MongoDB 101](https://reader037.vdocuments.pub/reader037/viewer/2022100104/58e90abd1a28abc7598b5e41/html5/thumbnails/4.jpg)
REPLICATION AND SHARDING
OOTB
![Page 5: MongoDB 101](https://reader037.vdocuments.pub/reader037/viewer/2022100104/58e90abd1a28abc7598b5e41/html5/thumbnails/5.jpg)
GEOSPATIAL INDEX
![Page 6: MongoDB 101](https://reader037.vdocuments.pub/reader037/viewer/2022100104/58e90abd1a28abc7598b5e41/html5/thumbnails/6.jpg)
JSON BSON
{ _id : ObjectId("51d66af57d3afb7a973b00ab"), username : 'foo', firstName : 'John', lastName : 'Smith', address : { street : ‘5th N', city : ‘New York', zip : '00001' } friends : [ 'bill', 'frank', 'mike' ] }
![Page 7: MongoDB 101](https://reader037.vdocuments.pub/reader037/viewer/2022100104/58e90abd1a28abc7598b5e41/html5/thumbnails/7.jpg)
QUERIESCRUD
![Page 8: MongoDB 101](https://reader037.vdocuments.pub/reader037/viewer/2022100104/58e90abd1a28abc7598b5e41/html5/thumbnails/8.jpg)
FIND
![Page 9: MongoDB 101](https://reader037.vdocuments.pub/reader037/viewer/2022100104/58e90abd1a28abc7598b5e41/html5/thumbnails/9.jpg)
INSERT
![Page 10: MongoDB 101](https://reader037.vdocuments.pub/reader037/viewer/2022100104/58e90abd1a28abc7598b5e41/html5/thumbnails/10.jpg)
UPDATE3 ways
![Page 11: MongoDB 101](https://reader037.vdocuments.pub/reader037/viewer/2022100104/58e90abd1a28abc7598b5e41/html5/thumbnails/11.jpg)
REMOVE
![Page 12: MongoDB 101](https://reader037.vdocuments.pub/reader037/viewer/2022100104/58e90abd1a28abc7598b5e41/html5/thumbnails/12.jpg)
PROJEKTOWANIE SCHEMATUSchemaless != Don’t plan
![Page 13: MongoDB 101](https://reader037.vdocuments.pub/reader037/viewer/2022100104/58e90abd1a28abc7598b5e41/html5/thumbnails/13.jpg)
RELATIONAL MODEL
![Page 14: MongoDB 101](https://reader037.vdocuments.pub/reader037/viewer/2022100104/58e90abd1a28abc7598b5e41/html5/thumbnails/14.jpg)
DOCUMENT MODEL{ _id : ObjectId("51d66af57d3afb7a973b00ab"), author : 'john', title : 'Interesting post', body : 'Lorem Ipsum', date : ISODate("2012-12-19T20:10:56.920Z"), tags : [ 'lorem', 'lifestyle', 'eating' ], comments : [ { author : 'Anonymous', date : ISODate("2012-12-19T20:10:56.920Z"), body : 'Boooring!' }, { author : 'Frankie', date : ISODate("2012-12-19T20:10:56.920Z"), body : ‘Not boring at all.' } ] }
![Page 15: MongoDB 101](https://reader037.vdocuments.pub/reader037/viewer/2022100104/58e90abd1a28abc7598b5e41/html5/thumbnails/15.jpg)
GEOSPATIAL INDEXdb.places.ensureIndex( { location: ‘2d’ } )
![Page 16: MongoDB 101](https://reader037.vdocuments.pub/reader037/viewer/2022100104/58e90abd1a28abc7598b5e41/html5/thumbnails/16.jpg)
db.places.find( { location: { $near : [ 52, 21 ] } } )
![Page 17: MongoDB 101](https://reader037.vdocuments.pub/reader037/viewer/2022100104/58e90abd1a28abc7598b5e41/html5/thumbnails/17.jpg)
MONGODB AND PHPpecl install mongo
![Page 18: MongoDB 101](https://reader037.vdocuments.pub/reader037/viewer/2022100104/58e90abd1a28abc7598b5e41/html5/thumbnails/18.jpg)
DEMO
![Page 19: MongoDB 101](https://reader037.vdocuments.pub/reader037/viewer/2022100104/58e90abd1a28abc7598b5e41/html5/thumbnails/19.jpg)
DOCTRINEDEMO
![Page 20: MongoDB 101](https://reader037.vdocuments.pub/reader037/viewer/2022100104/58e90abd1a28abc7598b5e41/html5/thumbnails/20.jpg)
SIDENOTE$qb = $dm->createQueryBuilder('Application_Model_Entry')
->field('club.$id')->equals(new MongoId($club->getId()));