MCPcopy Create free account
hub / github.com/IceClusters/icmysql / MongoInsertMany

Function MongoInsertMany

src/db/mongo/Query.js:39–54  ·  view source on GitHub ↗
(dbId, params, callback)

Source from the content-addressed store, hash-verified

37}
38
39async 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
56async function MongoFindOne(dbId, params, callback) {
57 try {

Callers

nothing calls this directly

Calls 3

MongoMiddlewareFunction · 0.85
PrepareObjectFunction · 0.85
ParseErrorFunction · 0.85

Tested by

no test coverage detected