MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / updateMany

Function updateMany

packages/core/fumadb/src/adapters/mongodb/query.ts:385–414  ·  view source on GitHub ↗
(table, v)

Source from the content-addressed store, hash-verified

383 return result.map((v) => mapResult(v, table));
384 },
385 async updateMany(table, v) {
386 const where = v.where ? buildWhere(v.where) : {};
387 const set: Record<string, unknown> = {};
388 const unset: Record<string, unknown> = {};
389
390 for (const k in v.set) {
391 const col = table.columns[k];
392 const value = v.set[k];
393 if (!col || value === undefined) continue;
394
395 const name = col.names.mongodb;
396
397 if (value === null) {
398 unset[name] = "";
399 } else {
400 set[name] = serialize(value);
401 }
402 }
403
404 await db.collection(table.names.mongodb).updateMany(
405 where,
406 {
407 $set: set,
408 $unset: unset,
409 },
410 {
411 session,
412 }
413 );
414 },
415 async create(table, values) {
416 const collection = db.collection(table.names.mongodb);
417 const { insertedId } = await collection.insertOne(

Callers

nothing calls this directly

Calls 2

buildWhereFunction · 0.70
serializeFunction · 0.70

Tested by

no test coverage detected