Skip to content

Commit

Permalink
Show helpful error when oplog is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
justinr1234 committed Jul 10, 2019
1 parent da42a95 commit ed1cec2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/models/server/models/_BaseDb.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ export class BaseDb extends EventEmitter {
collection: this.collectionName,
};

if (!MongoInternals.defaultRemoteCollectionDriver().mongo._oplogHandle) {
throw new Error(`Error: Unable to find Mongodb Oplog. You must run the server with oplog enabled. Try the following:\n
1. Start your mongodb in a replicaset mode: mongod --smallfiles --oplogSize 128 --replSet rs0\n
2. Start the replicaset via mongodb shell: mongo mongo/rocketchat --eval "rs.initiate({ _id: ''rs0'', members: [ { _id: 0, host: ''localhost:27017'' } ]})"\n
3. Start your Rocket.Chat instance with OPLOG configuration: export MONGO_OPLOG_URL=mongodb://localhost:27017/local node main.js
`);
}

MongoInternals.defaultRemoteCollectionDriver().mongo._oplogHandle.onOplogEntry(
query,
this.processOplogRecord.bind(this)
Expand Down

0 comments on commit ed1cec2

Please sign in to comment.