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
Tweet

More Decks by Tugdual Grall

Other Decks in Technology

Transcript

  1. @tgrall tug@mongodb.com 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 tug@mongodb.com Data Warehousing • SQL for reporting and analytics

    • Infrastructure complications • Additional maintenance • Data duplication • ETL processes • Real time?
  3. @tgrall tug@mongodb.com Aggregation Framework • Declared in JSON, executes in

    C++ • Flexible, functional, and simple • Operation pipeline • Computational expressions • Plays nice with sharding
  4. @tgrall tug@mongodb.com 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 tug@mongodb.com MongoDB Full Text Search • Turnkey search for

    apps • Lowest cost • Simplest ops • Multi Language Support
  6. @tgrall tug@mongodb.com Point {! ! "loc" : ! ! !

    {! ! ! ! "type" : "Point",! ! ! ! "coordinates" : [1.4528388, 43.5956005] ! ! ! }! }
  7. @tgrall tug@mongodb.com LineString {! ! "loc" : ! ! !

    {! ! ! ! "type" : "LineString",! ! ! ! "coordinates" : [ [1.4528388, 43.5956005], 
 ! ! ! ! ! ! ! [1.3996881, 43.5976828] ] ! ! ! }! }
  8. @tgrall tug@mongodb.com 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 tug@mongodb.com Near a point db.points.find( { "loc" :{$near :

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

    "loc" :{!! ! ! ! $geoIntersects : {! ! ! ! ! $geometry : ! ! ! ! ! {type : "Point", ! ! ! ! ! coordinates:[1.443934, 43.604446]}! ! ! ! }! ! ! }! ! });
  11. @tgrall tug@mongodb.com 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]]] ! ! ! ! }}}});