MCPcopy Create free account
hub / github.com/documentdb/documentdb / ProcessBatchUpdateUnsharded

Function ProcessBatchUpdateUnsharded

pg_documentdb/src/commands/update.c:1416–1439  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1414
1415
1416static pgbson *
1417ProcessBatchUpdateUnsharded(MongoCollection *collection, BatchUpdateSpec *batchSpec,
1418 text *transactionId, bool *hasWriteErrors)
1419{
1420 Assert(collection->shardKey == NULL);
1421
1422 pgbsonsequence *updateSequence = batchSpec->updateSequence;
1423 const bson_value_t *updateValue = updateSequence == NULL ? &batchSpec->updateValue :
1424 NULL;
1425
1426 pgbson *updateSpecs = SerializeUnshardedUpdateParams(updateValue,
1427 batchSpec->isOrdered,
1428 batchSpec->
1429 bypassDocumentValidation,
1430 &batchSpec->variableSpec);
1431
1432 /* since this is unsharded, the keyHash is just the collection id. */
1433 int shardKeyHash = collection->collectionId;
1434 Datum workerResult = CallUpdateWorker(collection, updateSpecs, updateSequence,
1435 shardKeyHash, transactionId);
1436
1437 pgbson *response = DatumGetPgBson(workerResult);
1438 return DeserializeBatchUpdateWorkerResponse(response, hasWriteErrors);
1439}
1440
1441
1442static void

Callers 1

PerformUpdateCoreFunction · 0.85

Calls 3

CallUpdateWorkerFunction · 0.85

Tested by

no test coverage detected