From ef673b7e0ec36003fbf4ef15e0761c3effe1c66f Mon Sep 17 00:00:00 2001 From: Alec Gibson Date: Tue, 14 Aug 2018 16:28:46 +0100 Subject: [PATCH] Always include `m` in snapshot This change updates the `MongoSnapshot` class to always include the `m` field, in line with the [recent change to the core `Snapshot` class][1] [1]: https://github.com/share/sharedb/pull/220/files#diff-09a9af1416a54a5b125a5c2e1e6c2a30R7 --- index.js | 2 +- package.json | 2 +- test/test_mongo.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 24d712a3..dea9f590 100644 --- a/index.js +++ b/index.js @@ -1221,7 +1221,7 @@ function MongoSnapshot(id, version, type, data, meta, opLink) { this.v = version; this.type = type; this.data = data; - if (meta) this.m = meta; + this.m = meta == null ? null : meta; if (opLink) this._opLink = opLink; } diff --git a/package.json b/package.json index c17b1126..a546abee 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "expect.js": "^0.3.1", "istanbul": "^0.4.2", "mocha": "^2.3.3", - "sharedb-mingo-memory": "^1.0.1" + "sharedb-mingo-memory": "^1.0.2" }, "scripts": { "test": "node_modules/.bin/mocha", diff --git a/test/test_mongo.js b/test/test_mongo.js index d5ee6f67..5530e6a5 100644 --- a/test/test_mongo.js +++ b/test/test_mongo.js @@ -353,7 +353,7 @@ describe('mongo db connection', function() { }); it('commit and query', function(done) { - var snapshot = {type: 'json0', v: 1, data: {}, id: "test"}; + var snapshot = {type: 'json0', v: 1, data: {}, id: "test", m: null}; var db = this.db; db.commit('testcollection', snapshot.id, {v: 0, create: {}}, snapshot, null, function(err) {