Upload
tugdual-grall
View
297
Download
0
Tags:
Embed Size (px)
DESCRIPTION
Some cool features of MongoDB : Geospatial, Full Text Search, Aggregation Framework. Presentation delivered May 2014 at the ESPRIT JUG Day 2014, Tunis
Citation preview
Technical Evangelist, MongoDB@tgrall
Tugdual Grall
@EspritJUG
Some cool features of MongoDB
Real Time Analytics
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?
Data Warehousing
• SQL for reporting and analytics
• Infrastructure complications
• Additional maintenance
• Data duplication
• ETL processes
• Real time?
Aggregation Framework
• Declared in JSON, executes in C++
• Flexible, functional, and simple
• Operation pipeline
• Computational expressions
• Plays nice with sharding
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
Search…
MongoDB Full Text Search
• Turnkey search for apps
• Lowest cost
• Simplest ops
• Multi Language Support
GeoSpatial
• Store Geographical Informations
• … and query them!
GeoSpatial
How do you store information?
http://geojson.org/
Point
{!! "loc" : !! ! {!! ! ! "type" : "Point",!! ! ! "coordinates" : [1.4528388, 43.5956005] !! ! }!}
LineString{!! "loc" : !! ! {!! ! ! "type" : "LineString",!! ! ! "coordinates" : [ [1.4528388, 43.5956005], ! ! ! ! ! ! ! [1.3996881, 43.5976828] ] !! ! }!}
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] ] !! ! }!}
Near a pointdb.points.find(
{ "loc" :{$near : {$geometry : { type : "Point", coordinates : [1.4528388, 43.5956005] }, $maxDistance : 500
Query : “in” the polygondb.points.find(!! { "loc" :{!!! ! ! $geoIntersects : {!! ! ! ! $geometry : !! ! ! ! {type : "Point", !! ! ! ! coordinates:[1.443934, 43.604446]}!! ! ! }!! ! }!! });
Query : all points in a Polygondb.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]]] !! ! ! }}}});
Questions?
#ConferenceHashtag
Thank You