(dbId, params, callback)
| 37 | } |
| 38 | |
| 39 | async function MongoInsertMany(dbId, params, callback) { |
| 40 | try { |
| 41 | if (typeof callback !== "function") callback = null; |
| 42 | const data = await MongoMiddleware(dbId, params); |
| 43 | if (typeof data !== "object") return null; |
| 44 | |
| 45 | const documents = PrepareObject(data.params.documents); |
| 46 | const options = PrepareObject(data.params.options); |
| 47 | const collection = global.MongoConnections[dbId].collection(params.collection) |
| 48 | const result = await collection.insertMany(documents, options); |
| 49 | return callback ? callback(result) : result; |
| 50 | } catch (error) { |
| 51 | ParseError("MongoDB find error catched:", error.message); |
| 52 | return callback ? callback(null) : null; |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | async function MongoFindOne(dbId, params, callback) { |
| 57 | try { |
nothing calls this directly
no test coverage detected