mirror of
https://github.com/FerretDB/documentdb.git
synced 2026-11-26 04:09:50 -05:00
### 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> ]}
```
42 lines
1.4 KiB
C
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
|