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

Function IsPgbsonWriterEmptyDocument

pg_documentdb_core/src/io/pgbson.c:1923–1927  ·  view source on GitHub ↗

* Validate if the bson inside pgbson_writer is an empty document. * Note that the bson spec (https://bsonspec.org/spec.html) implies that an array has * 4 bytes for the array length, followed by a list of [ 1 byte type code, path, value] * This implies that a non empty array has 4 bytes of length, 1 byte of type code * (for the first element), and at least 1 byte for the index path which is 6

Source from the content-addressed store, hash-verified

1921 * (for the first element), and at least 1 byte for the index path which is 6 bytes at least.
1922 */
1923bool
1924IsPgbsonWriterEmptyDocument(pgbson_writer *writer)
1925{
1926 return writer != NULL && PgbsonWriterGetSize(writer) < 6;
1927}
1928
1929
1930/*

Callers 4

MakeIndexSpecForIndexDefFunction · 0.85
SerializeIndexSpecFunction · 0.85

Calls 1

PgbsonWriterGetSizeFunction · 0.85

Tested by

no test coverage detected