diff --git a/services/track-changes/app/js/PackManager.js b/services/track-changes/app/js/PackManager.js index 5d753aebb2..fcdf48dbf7 100644 --- a/services/track-changes/app/js/PackManager.js +++ b/services/track-changes/app/js/PackManager.js @@ -16,7 +16,9 @@ let PackManager const async = require('async') const _ = require('underscore') -const { db, ObjectId, BSON } = require('./mongojs') +const Bson = require('bson') +const BSON = new Bson() +const { db, ObjectId } = require('./mongojs') const logger = require('logger-sharelatex') const LockManager = require('./LockManager') const MongoAWS = require('./MongoAWS') diff --git a/services/track-changes/app/js/PackWorker.js b/services/track-changes/app/js/PackWorker.js index e6a02fef3d..a0baa3e0df 100644 --- a/services/track-changes/app/js/PackWorker.js +++ b/services/track-changes/app/js/PackWorker.js @@ -18,7 +18,7 @@ let project_id, doc_id const Settings = require('settings-sharelatex') const async = require('async') const _ = require('underscore') -const { db, ObjectId, BSON } = require('./mongojs') +const { db, ObjectId } = require('./mongojs') const fs = require('fs') const Metrics = require('metrics-sharelatex') Metrics.initialize('track-changes') diff --git a/services/track-changes/app/js/mongojs.js b/services/track-changes/app/js/mongojs.js index 6b99f87a4c..718d873873 100644 --- a/services/track-changes/app/js/mongojs.js +++ b/services/track-changes/app/js/mongojs.js @@ -2,7 +2,6 @@ // Sanity-check the conversion and remove this comment. const Settings = require('settings-sharelatex') const mongojs = require('mongojs') -const bson = require('bson') const db = mongojs(Settings.mongo.url, [ 'docHistory', 'projectHistoryMetaData', @@ -10,6 +9,5 @@ const db = mongojs(Settings.mongo.url, [ ]) module.exports = { db, - ObjectId: mongojs.ObjectId, - BSON: new bson.BSONPure() + ObjectId: mongojs.ObjectId } diff --git a/services/track-changes/package-lock.json b/services/track-changes/package-lock.json index a3545e5560..3560f12032 100644 --- a/services/track-changes/package-lock.json +++ b/services/track-changes/package-lock.json @@ -1572,9 +1572,9 @@ "dev": true }, "bson": { - "version": "0.4.23", - "resolved": "https://registry.npmjs.org/bson/-/bson-0.4.23.tgz", - "integrity": "sha512-xMUimhLm6y4t9BTW6BQGRHs9PODB9082EUX/Gkx6M9T2ktuJ5LvMxY/20ukuk0Uc+WPL37pbMIy731XF7eTxjg==" + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/bson/-/bson-1.1.5.tgz", + "integrity": "sha512-kDuEzldR21lHciPQAIulLs1LZlCXdLziXI6Mb/TDkwXhb//UORJNPXgcRs2CuO4H0DcMkpfT3/ySsP3unoZjBg==" }, "buffer": { "version": "4.9.1", @@ -4727,13 +4727,6 @@ "require_optional": "^1.0.1", "safe-buffer": "^5.1.2", "saslprep": "^1.0.0" - }, - "dependencies": { - "bson": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/bson/-/bson-1.1.3.tgz", - "integrity": "sha512-TdiJxMVnodVS7r0BdL42y/pqC9cL2iKynVwA0Ho3qbsQYr428veL3l7BQyuqiw+Q5SqqoT0m4srSY/BlZ9AxXg==" - } } }, "mongojs": { diff --git a/services/track-changes/package.json b/services/track-changes/package.json index e67d309a35..f1e4146cbe 100644 --- a/services/track-changes/package.json +++ b/services/track-changes/package.json @@ -22,7 +22,7 @@ "async": "^2.6.3", "aws-sdk": "^2.643.0", "body-parser": "^1.19.0", - "bson": "^0.4.20", + "bson": "^1.1.5", "byline": "^5.0.0", "express": "4.17.1", "heap": "^0.2.6", diff --git a/services/track-changes/test/unit/js/PackManager/PackManagerTests.js b/services/track-changes/test/unit/js/PackManager/PackManagerTests.js index 6a5708fd9f..ce53e3e5b0 100644 --- a/services/track-changes/test/unit/js/PackManager/PackManagerTests.js +++ b/services/track-changes/test/unit/js/PackManager/PackManagerTests.js @@ -18,8 +18,6 @@ const { expect } = chai const modulePath = '../../../../app/js/PackManager.js' const SandboxedModule = require('sandboxed-module') const { ObjectId } = require('mongojs') -const bson = require('bson') -const BSON = new bson.BSONPure() const _ = require('underscore') const tk = require('timekeeper') @@ -29,7 +27,8 @@ describe('PackManager', function () { tk.freeze(new Date()) this.PackManager = SandboxedModule.require(modulePath, { requires: { - './mongojs': { db: (this.db = {}), ObjectId, BSON }, + bson: require('bson'), + './mongojs': { db: (this.db = {}), ObjectId }, './LockManager': {}, './MongoAWS': {}, 'logger-sharelatex': { log: sinon.stub(), error: sinon.stub() },