If you can't read please download the document
Upload
mark-smalley
View
3.064
Download
0
Embed Size (px)
Citation preview
WHY I BELIEVE MONGODB IS THE DOG'SBOLLOCKS
Mr. Mongo Mark @m_smalley
PERSPECTIVE
WHERE I CAME FROM( and yes I'm a bit of a star wars fan )
1992 - Manchester
BASIC( information kiosk for imaginary town )
1997 - Miri
FLASH( also started designing )
2005 Kuala Lumpur
HTML + CSS( started my own web-development company )
2010 Laulima
MET MONGO( fell in love )
2011 Silicon Valley
RECOGNITION( starting with a mug and ending with a master )
CONFESSION #1
CONFESSION #1
I'M NO MASTER( but I do know how to make the most of things )
CONFESSION #2
CONFESSION #2
IT'S REALLY EASY( once you've got it all set up )
FOREXAMPLE
THERE IS NO SPOON !!!( or need to leave your app )
NO LANGUAGE BARRIERS !!!( all the logic is in one place )
WhymongoDB
?
EXCELLENT GEOLOCATION SUPPORT( have you ever heard of Foursquare ...? )
IT'S LIGHTENING FAST !!!( some say 6,000 times faster in fact )
SCHEMA-LESS JSON DATA( otherwise known as freedom )
REPLICA-SETS & SHARDING( load-balancing and auto back-ups built-in from day one )
LASTBUT NOTLEAST
GRIDFS( media storage and serving )
EXAMPLE PHPCODE
CREATE DB + COLLECTION + INSERT DATA
// MongoDB PHP Class$m = new Mongo();
// Select Database & Collection (Table)$db = $m->freesquare;$collectiom = $db->places;
// Add Document (Add a Record)$obj = array( "title" => "KL MongoDB User-Group", "loc" => array( "lng" => 101.67646, "lat" => 3.127896 ))$results = $collection->insert($obj);
HAVING ADDED SEVERAL PLACES
// Assuming collection is defined// We can now add the GeoSpatial Index$collection->ensureIndex(array("loc"=>"2d");
// Defining my current location$my_location = array(101.67646, 3.127896);
// Find Nearest Locations$nearest_place = $collection->command(array( "geoNear" => "loc", "near" => $my_location, "spherical" => true, "num" => 1))// Ready for AJAX listenersecho json_encode($nearest_place);
THE END RESULTS( if connected to something such as gSpot for example )
KL MongoDB User-Group
LEARN MOREBOLLOCKS( about mongoDB and the products, services and people using it )
Kuala Lumpur MongoDB User Grouphttps://www.facebook.com/groups/klmug/1st Wednesday of Every Month
Tweet Me - @m_smalley