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

Function PgbsonWriterAppendDocument

pg_documentdb_core/src/io/pgbson.c:1008–1021  ·  view source on GitHub ↗

* Appends given bson document to the writer with the specified path. */

Source from the content-addressed store, hash-verified

1006 * Appends given bson document to the writer with the specified path.
1007 */
1008void
1009PgbsonWriterAppendDocument(pgbson_writer *writer, const char *path, uint32_t pathLength,
1010 const pgbson *bson)
1011{
1012 bson_t rightBson;
1013 bson_init_static(&rightBson, (const uint8_t *) VARDATA_ANY(bson),
1014 (uint32_t) VARSIZE_ANY_EXHDR(bson));
1015 if (!bson_append_document(&(writer->innerBson), path, pathLength, &rightBson))
1016 {
1017 ereport(ERROR, (errcode(ERRCODE_DOCUMENTDB_BADVALUE),
1018 errmsg("adding document: failed due to document "
1019 "being too large")));
1020 }
1021}
1022
1023
1024/*

Calls

no outgoing calls

Tested by

no test coverage detected