Files
documentdb/pg_helio_api/include/operators/bson_expr_eval.h
T
Santiago Fernandez Madero 2ad7381f79 Merged PR 1291973: Add inverseMatch aggregation stage
### Does this PR have any customer impact?

### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)

### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)

### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))

### Description

Add inverseMatch aggregation stage

Currently it supports a spec like:
```
{ path: <path>, input: <doc or array of docs/path expression>, defaultResult: [optional | <bool> ]}
```

So if we want to fetch the input to the document query from an external collection, a lookup stage would need to be added prior to the inverseMatch.

The next stage of this feature is to support a spec like:
```
{ path: <path>, fromCollection: <coll>, pipelines: [$match/$project/$limit], defaultResult: [optional | <bool> ]}
```
2024-03-29 10:49:37 +03:00

42 lines
1.4 KiB
C

/*-------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
*
* include/bson/bson_expr_eval.h
*
* Common declarations of functions for handling expression evaluation on values for bson query expressions.
*
*-------------------------------------------------------------------------
*/
#ifndef BSON_EXPR_EVAL_H
#define BSON_EXPR_EVAL_H
#include "io/helio_bson_core.h"
typedef struct FuncExpr FuncExpr;
typedef struct ExprEvalState ExprEvalState;
ExprEvalState * GetExpressionEvalState(const bson_value_t *expression,
MemoryContext memoryContext);
ExprEvalState * GetExpressionEvalStateFromFuncExpr(const FuncExpr *expression,
MemoryContext memoryContext);
void FreeExprEvalState(ExprEvalState *exprEvalState, MemoryContext memoryContext);
bool EvalBooleanExpressionAgainstArray(ExprEvalState *evalState,
const bson_value_t *queryValue);
bool EvalBooleanExpressionAgainstValue(ExprEvalState *evalState,
const bson_value_t *queryValue,
bool shouldRecurseIfArray);
bson_value_t EvalExpressionAgainstArrayGetFirstMatch(ExprEvalState *evalState,
const bson_value_t *queryValue);
List * EvalExpressionAgainstArrayGetAllMatchingIndices(ExprEvalState *evalState,
const bson_value_t *arrayValue,
const bool shouldRecurseIfArray);
#endif