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

Function BuildUpdateSpecList

pg_documentdb/src/commands/update.c:905–933  ·  view source on GitHub ↗

* BuildUpdateSpecList iterates over an array of update operations and * builds a Update for each object. */

Source from the content-addressed store, hash-verified

903 * builds a Update for each object.
904 */
905static List *
906BuildUpdateSpecList(bson_iter_t *updateArrayIter, bool *hasUpsert,
907 const bson_value_t *variableSpec)
908{
909 List *updates = NIL;
910
911 while (bson_iter_next(updateArrayIter))
912 {
913 StringInfo fieldNameStr = makeStringInfo();
914 int arrIdx = list_length(updates);
915 appendStringInfo(fieldNameStr, "update.updates.%d", arrIdx);
916
917 EnsureTopLevelFieldType(fieldNameStr->data, updateArrayIter, BSON_TYPE_DOCUMENT);
918
919 bson_iter_t updateOperationIter;
920 bson_iter_recurse(updateArrayIter, &updateOperationIter);
921
922 UpdateSpec *update = BuildUpdateSpec(&updateOperationIter, variableSpec);
923
924 updates = lappend(updates, update);
925
926 if (update->updateOneParams.isUpsert)
927 {
928 *hasUpsert = true;
929 }
930 }
931 ReportUpdateFeatureUsage(list_length(updates));
932 return updates;
933}
934
935
936/*

Callers 2

BuildUpdatesFunction · 0.85
command_update_workerFunction · 0.85

Calls 3

EnsureTopLevelFieldTypeFunction · 0.85
BuildUpdateSpecFunction · 0.85
ReportUpdateFeatureUsageFunction · 0.85

Tested by

no test coverage detected