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

Function bson_get_value

pg_documentdb_core/src/io/bson_io.c:210–226  ·  view source on GitHub ↗

* bson_get_value returns the value of a path within a BSON document as another * BSON document. */

Source from the content-addressed store, hash-verified

208 * BSON document.
209 */
210Datum
211bson_get_value(PG_FUNCTION_ARGS)
212{
213 pgbson *document = PG_GETARG_PGBSON(0);
214 char *path = text_to_cstring(PG_GETARG_TEXT_PP(1));
215 bson_iter_t pathIterator;
216
217 if (PgbsonInitIteratorAtPath(document, path, &pathIterator))
218 {
219 const bson_value_t *value = bson_iter_value(&pathIterator);
220 PG_RETURN_POINTER(BsonValueToDocumentPgbson(value));
221 }
222 else
223 {
224 PG_RETURN_NULL();
225 }
226}
227
228
229/*

Callers

nothing calls this directly

Calls 2

PgbsonInitIteratorAtPathFunction · 0.85

Tested by

no test coverage detected