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

Real Time Analytics with MongoDB

Real Time Analytics with MongoDB

Presented at the Thames Valley, and later the London, MongoDB User Group in 2012. Really simple way to stream data from MongoDB for graphical visualisation in a browser using D3.

Julian Browne

May 31, 2012
Tweet

More Decks by Julian Browne

Other Decks in Programming

Transcript

  1. Make a capped collection Put stuff in Query it with

    a tailable cursor See stuff come out Send it somewhere useful Steps
  2. db.createCollection("name", {capped:true, size:1000}); Fixed size (bytes) or docs (sort of)

    Loop-around writes A few constraints can’t delete can’t do collection.remove() can’t grow doc size by default no _id index no _id uniqueness Make a Capped Collection
  3. c = db.collection.find({}) .addOption(2) // tailable .addOption(32); // wait The

    Tailable Cursor for(i=0;i<5;i++) { while(c.hasNext()) { var doc = c.next(); printjson( doc ); } }