Hacker News new | past | comments | ask | show | jobs | submit login

I can easily switch "RethinkDB" with "MongoDB" and the article would still be correct.



Except for the part about real time notifications, which is RethinkDB's killer feature.


How would RethinkDB's real-time capabilities compare to doing something like this with Mongo? (I'm genuinely curious about any shortcomings with the following implementation, besides scaling.)

    // plugins/replicate.js

    var replicator = require('replicator');

    module.exports = exports = function replicatePlugin (schema, options) {
      schema.pre('save', function (next) {
        // notify subscribers of save
        replicator.notify('save', this);
        next();
      });
    }



    // schemas/game.js

    var replicatePlugin = require('../plugins/replicate.js');
    var GameSchema = new Schema({ ... });
    GameSchema.plugin(replicatePlugin);


I don't know what the replicator module does, but from RethinkDB's end, it allows you to avoid polling (which is a scalability thing, lots of really nice library APIs are built on top of dead-slow polling of the database).

RethinkDB also lets you write queries and subscribe to changes on the query itself. So in mongo, you can tail the replication oplog to avoid polling, but you still need to filter every event happening on the database for the ones you're interested in. On top of that, if you need to do transformations of the data, you have to re-apply them to what you get from the oplog. With RethinkDB, you write the same query you would have, and the database can be very efficient in only sending changes you're actually interested in, and send them with the transformations you asked to be applied.

Check out these slides if you're interested: http://deontologician.github.io/node_talk/#/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: