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

Function bson_dollar_regex

pg_documentdb/src/query/bson_dollar_operators.c:982–996  ·  view source on GitHub ↗

* bson_dollar_regex implements the $regex functionality * in the runtime. This traverses the document based on * filter dot-notation syntax and for all possible values, checks * that at least one matches the regex on the value provided. */

Source from the content-addressed store, hash-verified

980 * that at least one matches the regex on the value provided.
981 */
982Datum
983bson_dollar_regex(PG_FUNCTION_ARGS)
984{
985 pgbson *document = PG_GETARG_PGBSON(0);
986 bson_iter_t documentIterator;
987 TraverseRegexValidateState state = {
988 { 0 }, { 0 }
989 };
990
991 pgbsonelement filterElement = PopulateRegexState(fcinfo, &state);
992 PgbsonInitIterator(document, &documentIterator);
993 TraverseBson(&documentIterator, filterElement.path, &state.traverseState,
994 &CompareExecutionFuncs);
995 PG_RETURN_BOOL(state.traverseState.compareResult == CompareResult_Match);
996}
997
998
999/*

Callers

nothing calls this directly

Calls 3

PopulateRegexStateFunction · 0.85
PgbsonInitIteratorFunction · 0.85
TraverseBsonFunction · 0.85

Tested by

no test coverage detected