'Why mongo updates first element in db despite the condition
tell me pls why this code updates firs element in db despite the condition. And i couldn't see any logs. Im using NestJs+Typeorm+Mongo
await this.workOrderModel
.updateOne({ createRequestId: 'someMockedVaue' }, { $set: { createFlowTrackingId: 'otherValue' } })
.then((updatedWorkOrder) => {
this.logger.verbose('Updated WorkOrder: %o', updatedWorkOrder);
})
.catch((err) => {
this.logger.error('Error on update WorkOrder: %o', err);
});
Solution 1:[1]
I understood what the problem is, if you specify the wrong field in the filter, it takes the first user in the db and changes the data
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Romik romikromik |
