1.1.0 • Published 9 years ago

mongodb-polling v1.1.0

Weekly downloads
1
License
ISC
Repository
github
Last release
9 years ago
var mongodb         = require('mongodb'),
    MongodbPolling  = require('mongodb-polling');

var mongodbPolling = new MongodbPolling();

mongodb.connect('mongodb://localhost:27017/local', function(err, db) {

    if(err)
        throw err;

    mongodbPolling.addListener('numberOfTweets', function(f) {
        db.collection('tweets').count({}, f);
    });

    mongodbPolling.addListener('newTweet', function(f) {
        db.collection('tweets').find({}).toArray(f);
    });

});

mongodbPolling.on('numberOfTweets', function(results) {
    console.log(results);
});

mongodbPolling.on('newTweet', function(results) {
    console.log(results);
});

Installation

$ npm install mongodb-polling
1.1.0

9 years ago

1.0.9

9 years ago

1.0.6

9 years ago

1.0.4

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago