DS
Size: a a a
DS
DS
M
M
schema.pre('updateOne', {
document: true,
query: false
}, function() {
let document = await this.model.findOne(this.getQuery());
if (document.field) {
next()
} else {
return;
}
});DS
db.getCollection("example_collection").updateOne(
{"string": {$elemMatch: {"date": 1, "type": "b"}}},
{$inc: {"string.$.something": +1}}
)DS
schema.pre('updateOne', {
document: true,
query: false
}, function() {
let document = await this.model.findOne(this.getQuery());
if (document.field) {
next()
} else {
return;
}
});M
db.getCollection("example_collection").updateOne(
{"string": {$elemMatch: {"date": 1, "type": "b"}}},
{$inc: {"string.$.something": +1}}
)DS
DS
M
DS
M
DS
M
ГМ
R
Mongo connect error { MongoNetworkError: failed to connect to server [mongodb:27017] on first connect [MongoError: Authentication failed.]
at Pool.<anonymous> (/app/node_modules/mongodb-core/lib/topologies/server.js:431:11)
at Pool.emit (events.js:182:13)
at Pool.EventEmitter.emit (domain.js:442:20)
at connect (/app/node_modules/mongodb-core/lib/connection/pool.js:557:14)
at callback (/app/node_modules/mongodb-core/lib/connection/connect.js:109:5)
at provider.auth.err (/app/node_modules/mongodb-core/lib/connection/connect.js:352:21)
at _authenticateSingleConnection (/app/node_modules/mongodb-core/lib/auth/auth_provider.js:66:11) at sendAuthCommand (/app/node_modules/mongodb-core/lib/auth/scram.js:177:16)
at Connection.messageHandler (/app/node_modules/mongodb-core/lib/connection/connect.js:334:5)
at Connection.emit (events.js:182:13)
at Connection.EventEmitter.emit (domain.js:442:20)
at processMessage (/app/node_modules/mongodb-core/lib/connection/connection.js:364:10)
at Socket.<anonymous> (/app/node_modules/mongodb-core/lib/connection/connection.js:533:15)
at Socket.emit (events.js:182:13)
at Socket.EventEmitter.emit (domain.js:442:20)
at addChunk (_stream_readable.js:283:12)
name: 'MongoNetworkError',
errorLabels: [ 'TransientTransactionError' ],
[Symbol(mongoErrorContextSymbol)]: {} }y
ГМ
V
y