Skip to content

Commit

Permalink
Verify if mongodb is gte 3.6 to allow usage of changestreams
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigok committed Sep 14, 2020
1 parent 58d9caf commit 335f45e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
6 changes: 4 additions & 2 deletions app/models/server/models/_oplogHandle.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

import { Meteor } from 'meteor/meteor';
import { MongoInternals } from 'meteor/mongo';
import semver from 'semver';
import s from 'underscore.string';
import { MongoClient, Cursor, Timestamp, Db } from 'mongodb';

Expand All @@ -22,8 +24,8 @@ class OplogHandle {
}

const { mongo } = MongoInternals.defaultRemoteCollectionDriver();
const { storageEngine } = await mongo.db.command({ serverStatus: 1 });
return storageEngine?.name === 'wiredTiger';
const { version, storageEngine } = await mongo.db.command({ serverStatus: 1 });
return storageEngine?.name === 'wiredTiger' && semver.satisfies(semver.coerce(version), '>=3.6.0');
}

async start(): Promise<OplogHandle> {
Expand Down
12 changes: 9 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"@types/moment-timezone": "^0.5.30",
"@types/mongodb": "^3.5.26",
"@types/react-dom": "^16.9.8",
"@types/semver": "^7.3.3",
"@types/toastr": "^2.1.38",
"@typescript-eslint/eslint-plugin": "^2.34.0",
"@typescript-eslint/parser": "^2.34.0",
Expand Down

0 comments on commit 335f45e

Please sign in to comment.