-
Notifications
You must be signed in to change notification settings - Fork 83
/
basic.ts
32 lines (30 loc) · 1.07 KB
/
basic.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
* Loads all Query and Projection operators
*/
import { Context, OperatorMap, OperatorType, useOperators } from "../core";
import * as booleanOperators from "../operators/expression/boolean";
import * as comparisonOperators from "../operators/expression/comparison";
import { $limit, $project, $skip, $sort } from "../operators/pipeline";
import * as projectionOperators from "../operators/projection";
import * as queryOperators from "../operators/query";
useOperators(OperatorType.EXPRESSION, {
...booleanOperators,
...comparisonOperators
} as OperatorMap);
useOperators(OperatorType.PIPELINE, {
$project,
$skip,
$limit,
$sort
} as OperatorMap);
useOperators(OperatorType.PROJECTION, projectionOperators as OperatorMap);
useOperators(OperatorType.QUERY, queryOperators as OperatorMap);
/** The basic context for queries. */
export const BASIC_CONTEXT = Context.init()
.addExpressionOps({
...booleanOperators,
...comparisonOperators
})
.addPipelineOps({ $project, $skip, $limit, $sort })
.addProjectionOps(projectionOperators)
.addQueryOps(queryOperators);