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

Dimitar Roustchev - Rapid Data Insights with Mo...

Dimitar Roustchev - Rapid Data Insights with MongoDB

MunichDataGeeks

August 20, 2013
Tweet

More Decks by MunichDataGeeks

Other Decks in Programming

Transcript

  1. Slide 1 | STYLIGHT | Proud to bleed purple |

    @stylight RAPID DATA INSIGHTS With MongoDB’s Aggregation Framework
  2. Slide 2 | STYLIGHT | Proud to bleed purple |

    @stylight PIPELINE Aggregation Framework 1. A pipeline is a series of operations 2. Conceptually, members of a collection are passed through a pipeline to produce a result
  3. Slide 3 | STYLIGHT | Proud to bleed purple |

    @stylight PIPELINE OPERATIONS Aggregation Framework - $match - find({…}) - $sort - find().sort({…}) - $limit - find().limit() - $skip - find().skip() - $group - SQL’s GROUP BY - $unwind - dole out arrays! - $project - find({},{…}), but better!
  4. Slide 4 | STYLIGHT | Proud to bleed purple |

    @stylight EXPRESSION OPERATIONS Aggregation Framework - Conditional: $cond, $ifNull - Boolean: $and, $or, $not - Comparison: $cmp, $eq, $ne, $gt, $gte, $lt, $lte - Arithmetic: $add, $multiply, $subtract, $divide, $mod - String: $strcasecmp, $substr, $concat, $toUpper, $toLower - Date: $dayOf[Year|Month|Week], $year, $month, …, $millisecond - Group: $sum, $avg, $min, $max, $first, $last, $push, $addToSet
  5. Slide 5 | STYLIGHT | Proud to bleed purple |

    @stylight STYLIGHT Our data Stylight Shop click-outs transactions
  6. Slide 6 | STYLIGHT | Proud to bleed purple |

    @stylight LIVE EXAMPLES Aggregation Framework Let’s dig in!
  7. Slide 7 | STYLIGHT | Proud to bleed purple |

    @stylight TIPS AND LIMITATIONS Aggregation Framework Tips: - Use $match/$sort as early as possible in pipeline - Can’t use $project to create arrays! Limitations: - Result size is limited to 16MB - Memory limits for certain pipeline operators ($sort) - Some types unsupported: Binary, Code, deprecated types
  8. Slide 8 | STYLIGHT | Proud to bleed purple |

    @stylight CONCLUSION Aggregation Framework - Nice addition to toolbox for getting quick insights - No silver bullet!
  9. Slide 9 | STYLIGHT | Proud to bleed purple |

    @stylight THANK YOU FOR YOUR ATTENTION! Questions?
  10. Dimitar Roustchev Backend Engineer STYLIGHT GmbH +49 (0)89 – 1222

    895 – 0 [email protected] @droustchev http://www.stylight.com Nymphenburger Straße 86 80636 Munich, Germany Slide 10 | STYLIGHT | Proud to bleed purple | @stylight
  11. Slide 11 | STYLIGHT | Proud to bleed purple |

    @stylight REFERENCES Aggregation Framework - Aggregation Framework: http://docs.mongodb.org/manual/reference/aggregation