diff --git a/index.js b/index.js index b1e01fb..22f69b5 100644 --- a/index.js +++ b/index.js @@ -4,8 +4,14 @@ var isObject = require('lodash.isobject'); var sharedbMongoUtils = require('./sharedb-mongo-utils'); var util = require('sharedb/lib/util'); -// This is designed for use in tests, so load all Mingo query operators -require('mingo/init/system'); +// This is designed for use in tests, so load all Mingo query operators. Mingo 7 +// removed this subpath and auto-loads every operator from the default module, so +// the explicit require is only needed for Mingo 6. +try { + require('mingo/init/system'); +} catch (error) { + if (error.code !== 'ERR_PACKAGE_PATH_NOT_EXPORTED') throw error; +} // Snapshot properties added to the root doc by `castToDoc()` in sharedb-mongo var MONGO_DOC_PROPERTIES = { diff --git a/package.json b/package.json index e0e08f3..97cbbab 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "dependencies": { "lodash.clonedeep": "^4.5.0", "lodash.isobject": "^3.0.2", - "mingo": "6.1.0 - 6.2.1" + "mingo": "6.1.0 - 7.2.3" }, "peerDependencies": { "sharedb": "^1.0.0-beta || ^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0"