Refactoring day1

This commit is contained in:
2020-08-20 20:27:14 +02:00
parent 6aceefeb2f
commit b907489a75
481 changed files with 5321 additions and 5616 deletions

View File

@@ -140,7 +140,7 @@ function iter(i) {
}
}
if (this._shouldBufferCommands() && this.buffer) {
if (this.buffer) {
if (syncCollectionMethods[i]) {
throw new Error('Collection method ' + i + ' is synchronous');
}
@@ -148,9 +148,6 @@ function iter(i) {
this.addQueue(i, args);
return;
}
this.conn.emit('buffer', { method: i, args: args });
return new this.Promise((resolve, reject) => {
this.addQueue(i, [].concat(args).concat([(err, res) => {
if (err != null) {
@@ -173,10 +170,6 @@ function iter(i) {
}
try {
if (collection == null) {
throw new MongooseError('Cannot call `' + this.name + '.' + i + '()` before initial connection is complete if `bufferCommands = false`. Make sure you `await mongoose.connect()` if you have `bufferCommands = false`.');
}
return collection[i].apply(collection, args);
} catch (error) {
// Collection operation may throw because of max bson size, catch it here