mongodb 101
Post on 08-Apr-2017
180 Views
Preview:
TRANSCRIPT
MONGODB 101Introduction to document database
PHPers.0215 lipca 2013
Leszek Krupiński@leafnode
BASICSNoSQL and document databases
MONGODBDocument database, object store
REPLICATION AND SHARDING
OOTB
GEOSPATIAL INDEX
JSON BSON
{ _id : ObjectId("51d66af57d3afb7a973b00ab"), username : 'foo', firstName : 'John', lastName : 'Smith', address : { street : ‘5th N', city : ‘New York', zip : '00001' } friends : [ 'bill', 'frank', 'mike' ] }
QUERIESCRUD
FIND
INSERT
UPDATE3 ways
REMOVE
PROJEKTOWANIE SCHEMATUSchemaless != Don’t plan
RELATIONAL MODEL
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.' } ] }
GEOSPATIAL INDEXdb.places.ensureIndex( { location: ‘2d’ } )
db.places.find( { location: { $near : [ 52, 21 ] } } )
MONGODB AND PHPpecl install mongo
DEMO
DOCTRINEDEMO
SIDENOTE$qb = $dm->createQueryBuilder('Application_Model_Entry')
->field('club.$id')->equals(new MongoId($club->getId()));
top related