Files
meteor/packages/npm-mongo/wrapper.js
Ben Newman 2a8dea8934 Silence deprecation warnings introduced in a mongodb patch update.
These deprecation warnings were introduced in mongodb@3.1.2:
https://github.com/mongodb/node-mongodb-native/commit/a5d0f1d7e1

Fortunately, the deprecated Collection methods still work, and the
deprecation relies on Node's require("util").deprecate API, which can be
silenced permanently for a given function by temporarily setting
`process.noDeprecation = true` while defining the function:
https://github.com/nodejs/node/blob/2ae98ce7cb/lib/internal/util.js#L23-L29

Fixing #10174 by updating mongodb seems more important than reverting the
update to silence these harmless deprecation warnings (which, it bears
repeating, were introduced in a patch update).

Thanks to @klaussner for raising this concern!
2018-09-18 15:53:34 -04:00

12 lines
416 B
JavaScript

const oldNoDeprecationValue = process.noDeprecation;
try {
// Silence deprecation warnings introduced in a patch update to mongodb:
// https://github.com/meteor/meteor/pull/9942#discussion_r218564879
process.noDeprecation = true;
NpmModuleMongodb = Npm.require('mongodb');
} finally {
process.noDeprecation = oldNoDeprecationValue;
}
NpmModuleMongodbVersion = Npm.require('mongodb/package.json').version;