diff --git a/packages/mongo/mongo_driver.js b/packages/mongo/mongo_driver.js index 31f01bb00d..806e9802d4 100644 --- a/packages/mongo/mongo_driver.js +++ b/packages/mongo/mongo_driver.js @@ -23,7 +23,7 @@ import { MongoInternals = {}; // TODO remove after test -MongoInternals.__packageName = 'mongo' +MongoInternals.__packageName = 'mongo-async'; MongoInternals.NpmModules = { mongodb: { @@ -481,6 +481,13 @@ MongoConnection.prototype._update = async function (collection_name, selector, m if (!mod || typeof mod !== 'object') { const error = new Error("Invalid modifier. Modifier must be an object."); + if (callback) { + return callback(error); + } else { + throw error; + } + } + throw error; } diff --git a/packages/mongo/mongo_livedata_tests.js b/packages/mongo/mongo_livedata_tests.js index f2737c23f8..a7193ac889 100644 --- a/packages/mongo/mongo_livedata_tests.js +++ b/packages/mongo/mongo_livedata_tests.js @@ -206,8 +206,8 @@ _.each( ['STRING'], function(idGeneration) { }; const toAwait = ["insert", "remove", "update"].map(async (op) => { - var arg = (op === "insert" ? {} : 'bla'); - var arg2 = {}; + const arg = (op === "insert" ? {} : 'bla'); + const arg2 = {}; var callOp = async function () { if (op === "update") { @@ -1342,7 +1342,7 @@ _.each( ['STRING'], function(idGeneration) { await Meteor.callAsync('createInsecureCollection', this.collectionName); Meteor.subscribe('c-' + this.collectionName, expect()); } - }, async function (test, expect) { + }, async function (test) { const coll = new Mongo.Collection(this.collectionName, collectionOptions); const id = await runAndThrowIfNeeded(() => coll.insert({}), test); @@ -1361,7 +1361,7 @@ _.each( ['STRING'], function(idGeneration) { await Meteor.callAsync('createInsecureCollection', this.collectionName); Meteor.subscribe('c-' + this.collectionName, expect()); } - }, async function (test, expect) { + }, async function () { const coll = new Mongo.Collection(this.collectionName, collectionOptions); // No callback! Before fixing #2413, this method never returned and @@ -1382,7 +1382,7 @@ _.each( ['STRING'], function(idGeneration) { await Meteor.callAsync('createInsecureCollection', this.collectionName); Meteor.subscribe('c-' + this.collectionName, expect()); } - }, async function (test, expect) { + }, async function (test) { const coll = new Mongo.Collection(this.collectionName, collectionOptions); const testWidget = { name: 'Widget name' @@ -1405,7 +1405,7 @@ _.each( ['STRING'], function(idGeneration) { await Meteor.callAsync('createInsecureCollection', this.collectionName, collectionOptions); Meteor.subscribe('c-' + this.collectionName, expect()); } - }, async function (test, expect) { + }, async function (test) { const self = this; const coll = self.coll = new Mongo.Collection(self.collectionName, collectionOptions); @@ -1492,7 +1492,7 @@ _.each( ['STRING'], function(idGeneration) { })).seconds, 50); await self.coll.remove(id); }, - async function (test, expect) { + async function (test) { var self = this; self.id1 = await runAndThrowIfNeeded(() => self.coll.insert({d: new Date(1356152390004)}), test, false); test.isTrue(self.id1); @@ -1521,7 +1521,7 @@ _.each( ['STRING'], function(idGeneration) { Meteor.subscribe('c-' + this.collectionName, expect()); } }, - async function (test, expect) { + async function (test) { var self = this; self.coll = new Mongo.Collection(this.collectionName, collectionOptions); const id = await runAndThrowIfNeeded(() => self.coll.insert({}), test); @@ -1548,7 +1548,7 @@ _.each( ['STRING'], function(idGeneration) { await Meteor.callAsync('createInsecureCollection', this.collectionName, collectionOptions); Meteor.subscribe('c-' + this.collectionName, expect()); } - }, async function (test, expect) { + }, async function (test) { const coll = new Mongo.Collection(this.collectionName, collectionOptions); const id = await runAndThrowIfNeeded(() => coll.insert({b: bin}), test); test.isTrue(id); @@ -1569,7 +1569,7 @@ _.each( ['STRING'], function(idGeneration) { } }, - async function (test, expect) { + async function (test) { var self = this; self.coll = new Mongo.Collection(this.collectionName, collectionOptions); var docId; diff --git a/packages/mongo/package.js b/packages/mongo/package.js index e744c56705..f31b7efe27 100644 --- a/packages/mongo/package.js +++ b/packages/mongo/package.js @@ -9,7 +9,7 @@ Package.describe({ summary: "Adaptor for using MongoDB and Minimongo over DDP", - version: '1.16.3' + version: '1.16.0' }); Npm.depends({ @@ -82,7 +82,6 @@ Package.onUse(function (api) { api.addFiles('remote_collection_driver.js', 'server'); api.addFiles('collection.js', ['client', 'server']); api.addFiles('connection_options.js', 'server'); - api.addAssets('mongo.d.ts', 'server'); }); Package.onTest(function (api) {