28
Technical Evangelist, MongoDB @tgrall Tugdual Grall @EspritJUG Some cool features of MongoDB

Some cool features of MongoDB

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

Page 1: Some cool features of MongoDB

Technical Evangelist, MongoDB@tgrall

Tugdual Grall

@EspritJUG

Some cool features of MongoDB

Page 2: Some cool features of MongoDB

@[email protected]

Agenda

• Analytics

• Full Text Search

• Geospatial

Page 3: Some cool features of MongoDB

Real Time Analytics

Page 4: Some cool features of MongoDB

@[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?

Page 6: Some cool features of MongoDB

@[email protected]

Data Warehousing

• SQL for reporting and analytics

• Infrastructure complications

• Additional maintenance

• Data duplication

• ETL processes

• Real time?

Page 7: Some cool features of MongoDB

@[email protected]

Aggregation Framework

Page 8: Some cool features of MongoDB

@[email protected]

Aggregation Framework

• Declared in JSON, executes in C++

• Flexible, functional, and simple

• Operation pipeline

• Computational expressions

• Plays nice with sharding

Page 9: Some cool features of MongoDB

@[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

Page 12: Some cool features of MongoDB

Search…

Page 13: Some cool features of MongoDB

@[email protected]

I want all the “tweets” about “xxx”

Page 15: Some cool features of MongoDB

@[email protected]

MongoDB Full Text Search

• Turnkey search for apps

• Lowest cost

• Simplest ops

• Multi Language Support

Page 16: Some cool features of MongoDB

GeoSpatial

Page 17: Some cool features of MongoDB

@[email protected]

• Store Geographical Informations

• … and query them!

GeoSpatial

Page 18: Some cool features of MongoDB

@[email protected]

How do you store information?

http://geojson.org/

Page 19: Some cool features of MongoDB

@[email protected]

Point

{!! "loc" : !! ! {!! ! ! "type" : "Point",!! ! ! "coordinates" : [1.4528388, 43.5956005] !! ! }!}

Page 20: Some cool features of MongoDB

@[email protected]

LineString{!! "loc" : !! ! {!! ! ! "type" : "LineString",!! ! ! "coordinates" : [ [1.4528388, 43.5956005], ! ! ! ! ! ! ! [1.3996881, 43.5976828] ] !! ! }!}

Page 21: Some cool features of MongoDB

@[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] ] !! ! }!}

Page 24: Some cool features of MongoDB

@[email protected]

Near a pointdb.points.find(

{ "loc" :{$near : {$geometry : { type : "Point", coordinates : [1.4528388, 43.5956005] }, $maxDistance : 500

Page 25: Some cool features of MongoDB

@[email protected]

Query : “in” the polygondb.points.find(!! { "loc" :{!!! ! ! $geoIntersects : {!! ! ! ! $geometry : !! ! ! ! {type : "Point", !! ! ! ! coordinates:[1.443934, 43.604446]}!! ! ! }!! ! }!! });

Page 26: Some cool features of MongoDB

@[email protected]

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]]] !! ! ! }}}});

Page 27: Some cool features of MongoDB

Questions?

Page 28: Some cool features of MongoDB

#ConferenceHashtag

Thank You