mongo-watch
Advanced tools
Comparing version
{ | ||
"name":"mongo-watch", | ||
"description":"A mongo watcher. This ties into the MongoDB replication oplog, and exposes all data modifications via an EventEmitter.", | ||
"version":"0.2.6", | ||
"version":"0.2.7", | ||
"homepage":"http://github.com/TorchlightSoftware/mongo-watch", | ||
@@ -6,0 +6,0 @@ "repository":"git://github.com/TorchlightSoftware/mongo-watch.git", |
# Mongo Watch | ||
This watcher ties into the MongoDB replication log (local.oplog.rs) and notifies your watchers any time the data changes. | ||
This watcher ties into the MongoDB replication log (local.oplog.rs) by default, but you can also tie into local.oplog.$main on a master DB. It then notifies your watchers any time the data changes. | ||
In order to use this you must: | ||
*replication log* | ||
1. Have access to the oplog. This will not be available on shared DB hosting, as it would reveal everyone else's database transactions to you. | ||
2. Have replication enabled. This can be done by starting mongod with the option '--replSet someArbitraryName'. You must then call `rs.initiate()` from the mongo CLI. | ||
2. Have replication enabled. This can be done by starting mongod with the option `--replSet someArbitraryName`. You must then call `rs.initiate()` from the mongo CLI. | ||
*master log* | ||
1. Have access to the oplog. This will not be available on shared DB hosting, as it would reveal everyone else's database transactions to you. | ||
2. Start your mongod as `--master`. | ||
3. Use: `new MongoWatch({useMasterOplog:true})` | ||
The watcher is fairly low latency and overhead. On my machine a test with a single insert and watcher takes 20ms. The cursor used to tail the oplog is being initialized with {awaitdata: true} so the data should be getting pushed from MongoDB's internal mechanism, instead of polling. | ||
@@ -11,0 +19,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
22976
2.1%140
6.06%