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

Function BsonDollarInCore

pg_documentdb/src/query/bson_dollar_operators.c:3851–3874  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3849
3850
3851static Datum
3852BsonDollarInCore(PG_FUNCTION_ARGS, bool hasObjectIdArg)
3853{
3854 pgbson *document = PG_GETARG_PGBSON(0);
3855 bson_iter_t documentIterator;
3856 TraverseInValidateState state = { 0 };
3857
3858 pgbsonelement filterElement = { 0 };
3859 PopulateDollarInValidationState(fcinfo, &state, &filterElement, hasObjectIdArg);
3860
3861 PgbsonInitIterator(document, &documentIterator);
3862
3863 TraverseBson(&documentIterator, filterElement.path, &state.traverseState,
3864 &CompareExecutionFuncs);
3865 if (state.hasNull)
3866 {
3867 /* If any element in the input is null and the target path cannot be found in the document, we'll choose that document. */
3868 PG_RETURN_BOOL(state.traverseState.compareResult != CompareResult_Mismatch);
3869 }
3870 else
3871 {
3872 PG_RETURN_BOOL(state.traverseState.compareResult == CompareResult_Match);
3873 }
3874}
3875
3876
3877/*

Callers 3

bson_dollar_inFunction · 0.85
bson_dollar_in_object_idFunction · 0.85

Calls 3

PgbsonInitIteratorFunction · 0.85
TraverseBsonFunction · 0.85

Tested by

no test coverage detected