Instantly share code, notes, and snippets.

@alanshaw alanshaw/gist:10046987
Last active Aug 29, 2015

Embed
What would you like to do?
Meteor, MongoDB, oplog tailing and you

Meteor, MongoDB, oplog tailing and you


Prior art

  • Pub sub
  • Live data sets
  • Poll and diff

What's wrong with poll and diff?

  • More writes, more polls
  • Mongo bandwidth
  • Large record sets
  • Latency

What is oplog?

  • MongoDB replica set
  • A capped collection
  • A rolling record of all operations that modify data

What is oplog tailing?

  • Follow along and find out about changes immediately
  • Let the database tell us when things have changed

What does an entry look like?

{
    "ts" : Timestamp(1396897233, 1),
    "h" : NumberLong(-8686789604923146223),
    "v" : 2,
    "op" : "i",
    "ns" : "bookstore.users",
    "o" : {
        "password" : "$2a$10$ZK5uFJ8T4Z.TMbvafMIpauYQf0CrGN2DXbJrgVlbFlOgDHnTjWTw6",
        "email" : "test@example.org",
        "name" : "Test User",
        "settings" : {
            "fontSize" : 160,
            "colourScheme" : "standard"
        },
        "books" : [],
        "canAccessKeystone" : false,
        "joinDate" : ISODate("2014-04-07T19:00:33.371Z"),
        "_id" : ObjectId("5342f5d15d28ce2802021770"),
        "__v" : 0
    }
}

What does it mean?

  • Less computation
  • Reduced db bandwidth
  • More connected clients
  • Profit?

More info


@LeCoupa

This comment has been minimized.

Copy link

LeCoupa commented May 18, 2014

Nice! Great Summary!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment