(dbId, params, callback)
| 90 | } |
| 91 | |
| 92 | async function MongoUpdateOne(dbId, params, callback) { |
| 93 | try { |
| 94 | if (typeof callback !== "function") callback = null; |
| 95 | const data = await MongoMiddleware(dbId, params); |
| 96 | if (typeof data !== "object") return null; |
| 97 | |
| 98 | const query = PrepareObject(data.params.query); |
| 99 | const update = PrepareObject(data.params.update); |
| 100 | const options = PrepareObject(data.params.options); |
| 101 | |
| 102 | const collection = global.MongoConnections[dbId].collection(params.collection) |
| 103 | const result = await collection.updateOne(query, update, options); |
| 104 | return callback ? callback(result) : result; |
| 105 | } catch (error) { |
| 106 | ParseError("MongoDB find error catched:", error.message); |
| 107 | return callback ? callback(null) : null; |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | async function MongoUpdateMany(dbId, params, callback) { |
| 112 | try { |
nothing calls this directly
no test coverage detected