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

Function PgbsonToCanonicalExtendedJson

pg_documentdb_core/src/io/pgbson.c:444–457  ·  view source on GitHub ↗

* Converts a pgbson structure to an extended json * syntax string. */

Source from the content-addressed store, hash-verified

442 * syntax string.
443 */
444const char *
445PgbsonToCanonicalExtendedJson(const pgbson *bsonDocument)
446{
447 bson_t bson;
448 if (!bson_init_static(&bson, (const uint8_t *) VARDATA_ANY(bsonDocument),
449 VARSIZE_ANY_EXHDR(bsonDocument)))
450 {
451 ereport(ERROR, (errcode(ERRCODE_DOCUMENTDB_BADVALUE),
452 errmsg("invalid input syntax for BSON")));
453 }
454
455 /* since bson strings are palloced - we can simply return the string created. */
456 return bson_as_canonical_extended_json(&bson, NULL);
457}
458
459
460/*

Callers 3

bson_outFunction · 0.85
bson_to_json_stringFunction · 0.85
bsonaggvalue_outFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected