* 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. */
| 980 | * that at least one matches the regex on the value provided. |
| 981 | */ |
| 982 | Datum |
| 983 | bson_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 | /* |
nothing calls this directly
no test coverage detected