Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Some cool features of MongoDB

Some cool features of MongoDB

Some cool features of MongoDB : Geospatial, Full Text Search, Aggregation Framework.
Presentation delivered May 2014 at the ESPRIT JUG Day 2014, Tunis

Tugdual Grall

May 08, 2014

Transcript

28 slides
  1. @tgrall [email protected] State • We're storing our data in MongoDB

    • We need to do ad-hoc reporting, grouping, common aggregations, etc. • What are we using for this?
  2. @tgrall [email protected] Data Warehousing • SQL for reporting and analytics

    • Infrastructure complications • Additional maintenance • Data duplication • ETL processes • Real time?
  3. @tgrall [email protected] Aggregation Framework • Declared in JSON, executes in

    C++ • Flexible, functional, and simple • Operation pipeline • Computational expressions • Plays nice with sharding
  4. @tgrall [email protected] Pipeline • Process a stream of documents •

    Original input is a collection • Final output is a result document • Series of operators • Filter or transform data • Input/output chain
  5. @tgrall [email protected] MongoDB Full Text Search • Turnkey search for

    apps • Lowest cost • Simplest ops • Multi Language Support
  6. @tgrall [email protected] Point {! ! "loc" : ! ! !

    {! ! ! ! "type" : "Point",! ! ! ! "coordinates" : [1.4528388, 43.5956005] ! ! ! }! }
  7. @tgrall [email protected] LineString {! ! "loc" : ! ! !

    {! ! ! ! "type" : "LineString",! ! ! ! "coordinates" : [ [1.4528388, 43.5956005], 
 ! ! ! ! ! ! ! [1.3996881, 43.5976828] ] ! ! ! }! }
  8. @tgrall [email protected] Polygon {"loc" : ! ! ! { "type"

    : "Polygon",! ! ! ! "coordinates" : [! [1.4528388, 43.5956005],! ! ! ! ! ! ! ! ! [1.3996881, 43.5976828],! ! ! ! ! ! ! ! ! [1.4001065, 43.6364262],! ! ! ! ! ! ! ! ! [1.4518624, 43.6324835],
 ! ! ! ! ! ! ! ![1.4528388, 43.5956005] ] ! ! ! }! }
  9. @tgrall [email protected] Near a point db.points.find( { "loc" :{$near :

    {$geometry : { type : "Point", coordinates : [1.4528388, 43.5956005] }, $maxDistance : 500
  10. @tgrall [email protected] Query : “in” the polygon db.points.find(! ! {

    "loc" :{!! ! ! ! $geoIntersects : {! ! ! ! ! $geometry : ! ! ! ! ! {type : "Point", ! ! ! ! ! coordinates:[1.443934, 43.604446]}! ! ! ! }! ! ! }! ! });
  11. @tgrall [email protected] Query : all points in a Polygon db.points.find(!

    { "loc" :{ $geoWithin : ! ! ! {$geometry :! ! ! ! { "type" : "Polygon",! ! ! ! ! "coordinates" : [[! ! ! ! ! [1.4528388, 43.5956005],[1.3996881, 43.5976828],! ! ! ! ! [1.4001065, 43.6364262],[1.4518624, 43.6324835],! ! ! ! ! [1.4528388, 43.5956005]]] ! ! ! ! }}}});

More Decks by Tugdual Grall

Other Decks in Technology