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

Function SerializeUpdateOneResult

pg_documentdb/src/commands/update.c:2956–2984  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2954
2955
2956static pgbson *
2957SerializeUpdateOneResult(UpdateOneResult *result)
2958{
2959 pgbson_writer writer;
2960 PgbsonWriterInit(&writer);
2961
2962 PgbsonWriterAppendBool(&writer, "isRowUpdated", -1, result->isRowUpdated);
2963 PgbsonWriterAppendBool(&writer, "updateSkipped", -1, result->updateSkipped);
2964 PgbsonWriterAppendBool(&writer, "isRetry", -1, result->isRetry);
2965
2966 if (result->reinsertDocument != NULL)
2967 {
2968 PgbsonWriterAppendDocument(&writer, "reinsertDocument", -1,
2969 result->reinsertDocument);
2970 }
2971
2972 if (result->resultDocument != NULL)
2973 {
2974 PgbsonWriterAppendDocument(&writer, "resultDocument", -1, result->resultDocument);
2975 }
2976
2977 if (result->upsertedObjectId != NULL)
2978 {
2979 PgbsonWriterAppendDocument(&writer, "upsertedObjectId", -1,
2980 result->upsertedObjectId);
2981 }
2982
2983 return PgbsonWriterGetPgbson(&writer);
2984}
2985
2986
2987/* Serializes the batch update result as a pgbson to be sent back to the coordinator. We return the raw response and ok: true if there were no write errors otherwise false. */

Callers 1

command_update_workerFunction · 0.85

Calls 4

PgbsonWriterInitFunction · 0.85
PgbsonWriterAppendBoolFunction · 0.85
PgbsonWriterGetPgbsonFunction · 0.85

Tested by

no test coverage detected