* bson_out converts a binary serialized bson document to the extended json text format. */
| 79 | * bson_out converts a binary serialized bson document to the extended json text format. |
| 80 | */ |
| 81 | Datum |
| 82 | bson_out(PG_FUNCTION_ARGS) |
| 83 | { |
| 84 | pgbson *arg = PG_GETARG_PGBSON(0); |
| 85 | |
| 86 | const char *jsonString; |
| 87 | if (BsonTextUseJsonRepresentation) |
| 88 | { |
| 89 | jsonString = PgbsonToCanonicalExtendedJson(arg); |
| 90 | } |
| 91 | else |
| 92 | { |
| 93 | jsonString = PgbsonToHexadecimalString(arg); |
| 94 | } |
| 95 | |
| 96 | PG_RETURN_CSTRING(jsonString); |
| 97 | } |
| 98 | |
| 99 | |
| 100 | /* |
nothing calls this directly
no test coverage detected