mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Merge pull request #13434 from meteor/upgrade-mongo-5-callbacks
Upgrade Mongo node driver 6.x
This commit is contained in:
@@ -78,7 +78,10 @@ export const replaceMeteorAtomWithMongo = function (document) {
|
||||
return document;
|
||||
}
|
||||
if (document instanceof Mongo.ObjectID) {
|
||||
return new MongoDB.ObjectID(document.toHexString());
|
||||
return new MongoDB.ObjectId(document.toHexString());
|
||||
}
|
||||
if (document instanceof MongoDB.ObjectId) {
|
||||
return new MongoDB.ObjectId(document.toHexString());
|
||||
}
|
||||
if (document instanceof MongoDB.Timestamp) {
|
||||
// For now, the Meteor representation of a Mongo timestamp type (not a date!
|
||||
@@ -128,7 +131,7 @@ export const replaceMongoAtomWithMeteor = function (document) {
|
||||
var buffer = document.value(true);
|
||||
return new Uint8Array(buffer);
|
||||
}
|
||||
if (document instanceof MongoDB.ObjectID) {
|
||||
if (document instanceof MongoDB.ObjectId) {
|
||||
return new Mongo.ObjectID(document.toHexString());
|
||||
}
|
||||
if (document instanceof MongoDB.Decimal128) {
|
||||
@@ -162,4 +165,4 @@ export function replaceNames(filter, thing) {
|
||||
return ret;
|
||||
}
|
||||
return thing;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -412,7 +412,7 @@ MongoConnection.prototype.updateAsync = async function (collection_name, selecto
|
||||
if (options.upsert && meteorResult.insertedId) {
|
||||
if (knownId) {
|
||||
meteorResult.insertedId = knownId;
|
||||
} else if (meteorResult.insertedId instanceof MongoDB.ObjectID) {
|
||||
} else if (meteorResult.insertedId instanceof MongoDB.ObjectId) {
|
||||
meteorResult.insertedId = new Mongo.ObjectID(meteorResult.insertedId.toHexString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,14 +226,9 @@ export class OplogHandle {
|
||||
);
|
||||
|
||||
try {
|
||||
const isMasterDoc = await new Promise<any>((resolve, reject) => {
|
||||
this._oplogLastEntryConnection!.db
|
||||
.admin()
|
||||
.command({ ismaster: 1 }, (err: Error | null, result: any) => {
|
||||
if (err) reject(err);
|
||||
else resolve(result);
|
||||
});
|
||||
});
|
||||
const isMasterDoc = await this._oplogLastEntryConnection!.db
|
||||
.admin()
|
||||
.command({ ismaster: 1 });
|
||||
|
||||
if (!(isMasterDoc && isMasterDoc.setName)) {
|
||||
throw new Error("$MONGO_OPLOG_URL must be set to the 'local' database of a Mongo replica set");
|
||||
@@ -426,4 +421,4 @@ export function idForOp(op: OplogEntry): string {
|
||||
} else {
|
||||
throw Error("Unknown op: " + JSON.stringify(op));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3961,10 +3961,10 @@ Meteor.isServer &&
|
||||
Meteor.isServer &&
|
||||
Tinytest.add('mongo-livedata - npm modules', function(test) {
|
||||
// Make sure the version number looks like a version number.
|
||||
test.matches(MongoInternals.NpmModules.mongodb.version, /^4\.(\d+)\.(\d+)/);
|
||||
test.matches(MongoInternals.NpmModules.mongodb.version, /^6\.(\d+)\.(\d+)/);
|
||||
test.equal(typeof MongoInternals.NpmModules.mongodb.module, 'object');
|
||||
test.equal(
|
||||
typeof MongoInternals.NpmModules.mongodb.module.ObjectID,
|
||||
typeof MongoInternals.NpmModules.mongodb.module.ObjectId,
|
||||
'function'
|
||||
);
|
||||
|
||||
@@ -4509,4 +4509,4 @@ Tinytest.addAsync(
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
);
|
||||
|
||||
@@ -478,7 +478,7 @@ if (Meteor.isServer) {
|
||||
self.expects = [];
|
||||
self.insert = async function(fields) {
|
||||
return coll.insertAsync(
|
||||
Object.assign({ ts: new MongoInternals.MongoTimestamp(0, 0) }, fields)
|
||||
Object.assign({ ts: new MongoInternals.MongoTimestamp({ t: 0, i: 0 }) }, fields)
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -96,14 +96,7 @@ process.env.MONGO_OPLOG_URL &&
|
||||
}
|
||||
// XXX implement bulk insert #1255
|
||||
var rawCollection = self.collection.rawCollection();
|
||||
rawCollection.insertMany(
|
||||
docs,
|
||||
Meteor.bindEnvironment(
|
||||
expect(function(err) {
|
||||
test.isFalse(err);
|
||||
})
|
||||
)
|
||||
);
|
||||
await rawCollection.insertMany(docs);
|
||||
},
|
||||
|
||||
async function(test, expect) {
|
||||
|
||||
106
packages/npm-mongo/.npm/package/npm-shrinkwrap.json
generated
106
packages/npm-mongo/.npm/package/npm-shrinkwrap.json
generated
@@ -398,49 +398,14 @@
|
||||
"integrity": "sha512-CiJJvcRtIgzadHCYXw7dqEnMNRjhGZlYK05Mj9OyktqV8uVT8fD2BFOB7S1uwBE3Kj2Z+4UyPmFw/Ixgw/LAlA=="
|
||||
},
|
||||
"@types/whatwg-url": {
|
||||
"version": "8.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-8.2.2.tgz",
|
||||
"integrity": "sha512-FtQu10RWgn3D9U4aazdwIE2yzphmTJREDqNdODHrbrZmmMqI0vMheC/6NE/J1Yveaj8H+ela+YwWTjq5PGmuhA=="
|
||||
},
|
||||
"base64-js": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="
|
||||
},
|
||||
"bowser": {
|
||||
"version": "2.11.0",
|
||||
"resolved": "https://registry.npmjs.org/bowser/-/bowser-2.11.0.tgz",
|
||||
"integrity": "sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA=="
|
||||
"version": "11.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-11.0.5.tgz",
|
||||
"integrity": "sha512-coYR071JRaHa+xoEvvYqvnIHaVqaYrLPbsufM9BF63HkwI5Lgmy2QR8Q5K/lYDYo5AK82wOvSOS0UsLTpTG7uQ=="
|
||||
},
|
||||
"bson": {
|
||||
"version": "4.7.2",
|
||||
"resolved": "https://registry.npmjs.org/bson/-/bson-4.7.2.tgz",
|
||||
"integrity": "sha512-Ry9wCtIZ5kGqkJoi6aD8KjxFZEx78guTQDnpXWiNthsxzrxAK/i8E6pCHAIZTbaEFWcOCvbecMukfK7XUvyLpQ=="
|
||||
},
|
||||
"buffer": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
|
||||
"integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ=="
|
||||
},
|
||||
"fast-xml-parser": {
|
||||
"version": "4.4.1",
|
||||
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.4.1.tgz",
|
||||
"integrity": "sha512-xkjOecfnKGkSsOwtZ5Pz7Us/T6mrbPQrq0nh+aCO5V9nk5NLWmasAHumTKjiPJPWANe+kAZ84Jc8ooJkzZ88Sw=="
|
||||
},
|
||||
"ieee754": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
||||
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="
|
||||
},
|
||||
"ip-address": {
|
||||
"version": "9.0.5",
|
||||
"resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz",
|
||||
"integrity": "sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g=="
|
||||
},
|
||||
"jsbn": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz",
|
||||
"integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A=="
|
||||
"version": "6.9.0",
|
||||
"resolved": "https://registry.npmjs.org/bson/-/bson-6.9.0.tgz",
|
||||
"integrity": "sha512-X9hJeyeM0//Fus+0pc5dSUMhhrrmWwQUtdavaQeF3Ta6m69matZkGWV/MrBcnwUeLC8W9kwwc2hfkZgUuCX3Ig=="
|
||||
},
|
||||
"memory-pager": {
|
||||
"version": "1.5.0",
|
||||
@@ -448,64 +413,29 @@
|
||||
"integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg=="
|
||||
},
|
||||
"mongodb": {
|
||||
"version": "4.17.2",
|
||||
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.17.2.tgz",
|
||||
"integrity": "sha512-mLV7SEiov2LHleRJPMPrK2PMyhXFZt2UQLC4VD4pnth3jMjYKHhtqfwwkkvS/NXuo/Fp3vbhaNcXrIDaLRb9Tg=="
|
||||
"version": "6.10.0",
|
||||
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.10.0.tgz",
|
||||
"integrity": "sha512-gP9vduuYWb9ZkDM546M+MP2qKVk5ZG2wPF63OvSRuUbqCR+11ZCAE1mOfllhlAG0wcoJY5yDL/rV3OmYEwXIzg=="
|
||||
},
|
||||
"mongodb-connection-string-url": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.6.0.tgz",
|
||||
"integrity": "sha512-WvTZlI9ab0QYtTYnuMLgobULWhokRjtC7db9LtcVfJ+Hsnyr5eo6ZtNAt3Ly24XZScGMelOcGtm7lSn0332tPQ=="
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-3.0.1.tgz",
|
||||
"integrity": "sha512-XqMGwRX0Lgn05TDB4PyG2h2kKO/FfWJyCzYQbIhXUxz7ETt0I/FqHjUeqj37irJ+Dl1ZtU82uYyj14u2XsZKfg=="
|
||||
},
|
||||
"punycode": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
|
||||
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg=="
|
||||
},
|
||||
"smart-buffer": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
|
||||
"integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg=="
|
||||
},
|
||||
"socks": {
|
||||
"version": "2.8.3",
|
||||
"resolved": "https://registry.npmjs.org/socks/-/socks-2.8.3.tgz",
|
||||
"integrity": "sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw=="
|
||||
},
|
||||
"sparse-bitfield": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",
|
||||
"integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ=="
|
||||
},
|
||||
"sprintf-js": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz",
|
||||
"integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA=="
|
||||
},
|
||||
"strnum": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/strnum/-/strnum-1.0.5.tgz",
|
||||
"integrity": "sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA=="
|
||||
},
|
||||
"tr46": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz",
|
||||
"integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA=="
|
||||
},
|
||||
"tslib": {
|
||||
"version": "2.8.0",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz",
|
||||
"integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA=="
|
||||
},
|
||||
"undici-types": {
|
||||
"version": "6.19.8",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz",
|
||||
"integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw=="
|
||||
},
|
||||
"uuid": {
|
||||
"version": "9.0.1",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz",
|
||||
"integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA=="
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz",
|
||||
"integrity": "sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw=="
|
||||
},
|
||||
"webidl-conversions": {
|
||||
"version": "7.0.0",
|
||||
@@ -513,9 +443,9 @@
|
||||
"integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g=="
|
||||
},
|
||||
"whatwg-url": {
|
||||
"version": "11.0.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz",
|
||||
"integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ=="
|
||||
"version": "13.0.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-13.0.0.tgz",
|
||||
"integrity": "sha512-9WWbymnqj57+XEuqADHrCJ2eSXzn8WXIW/YSGaZtb2WKAInQ6CHfaUUcTyyver0p8BDg5StLQq8h1vtZuwmOig=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ Package.describe({
|
||||
});
|
||||
|
||||
Npm.depends({
|
||||
mongodb: "4.17.2",
|
||||
mongodb: "6.10.0"
|
||||
});
|
||||
|
||||
Package.onUse(function (api) {
|
||||
|
||||
@@ -448,11 +448,7 @@ var launchMongo = async function(options) {
|
||||
var yieldingMethod = async function(object, methodName, ...args) {
|
||||
return await Promise.race([
|
||||
stopPromise,
|
||||
new Promise((resolve, reject) => {
|
||||
object[methodName](...args, (err, res) => {
|
||||
err ? reject(err) : resolve(res);
|
||||
});
|
||||
}),
|
||||
object[methodName](...args),
|
||||
]);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user