This repository was archived by the owner on Feb 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 15 files changed +546
-0
lines changed
generator/config/expression Expand file tree Collapse file tree 15 files changed +546
-0
lines changed Original file line number Diff line number Diff line change @@ -15,3 +15,17 @@ arguments:
15
15
name : expression2
16
16
type :
17
17
- expression
18
+ tests :
19
+ -
20
+ name : ' Example'
21
+ link : ' https://www.mongodb.com/docs/manual/reference/operator/aggregation/cmp/#example'
22
+ pipeline :
23
+ -
24
+ $project :
25
+ item : 1
26
+ qty : 1
27
+ cmpTo250 :
28
+ $cmp :
29
+ - ' $qty'
30
+ - 250
31
+ _id : 0
Original file line number Diff line number Diff line change @@ -15,3 +15,17 @@ arguments:
15
15
name : expression2
16
16
type :
17
17
- expression
18
+ tests :
19
+ -
20
+ name : ' Example'
21
+ link : ' https://www.mongodb.com/docs/manual/reference/operator/aggregation/eq/#example'
22
+ pipeline :
23
+ -
24
+ $project :
25
+ item : 1
26
+ qty : 1
27
+ qtyEq250 :
28
+ $eq :
29
+ - ' $qty'
30
+ - 250
31
+ _id : 0
Original file line number Diff line number Diff line change @@ -15,3 +15,17 @@ arguments:
15
15
name : expression2
16
16
type :
17
17
- expression
18
+ tests :
19
+ -
20
+ name : ' Example'
21
+ link : ' https://www.mongodb.com/docs/manual/reference/operator/aggregation/gt/#example'
22
+ pipeline :
23
+ -
24
+ $project :
25
+ item : 1
26
+ qty : 1
27
+ qtyGt250 :
28
+ $gt :
29
+ - ' $qty'
30
+ - 250
31
+ _id : 0
Original file line number Diff line number Diff line change @@ -15,3 +15,17 @@ arguments:
15
15
name : expression2
16
16
type :
17
17
- expression
18
+ tests :
19
+ -
20
+ name : ' Example'
21
+ link : ' https://www.mongodb.com/docs/manual/reference/operator/aggregation/gte/#example'
22
+ pipeline :
23
+ -
24
+ $project :
25
+ item : 1
26
+ qty : 1
27
+ qtyGte250 :
28
+ $gte :
29
+ - ' $qty'
30
+ - 250
31
+ _id : 0
Original file line number Diff line number Diff line change @@ -15,3 +15,17 @@ arguments:
15
15
name : expression2
16
16
type :
17
17
- expression
18
+ tests :
19
+ -
20
+ name : ' Example'
21
+ link : ' https://www.mongodb.com/docs/manual/reference/operator/aggregation/lt/#example'
22
+ pipeline :
23
+ -
24
+ $project :
25
+ item : 1
26
+ qty : 1
27
+ qtyLt250 :
28
+ $lt :
29
+ - ' $qty'
30
+ - 250
31
+ _id : 0
Original file line number Diff line number Diff line change @@ -15,3 +15,17 @@ arguments:
15
15
name : expression2
16
16
type :
17
17
- expression
18
+ tests :
19
+ -
20
+ name : ' Example'
21
+ link : ' https://www.mongodb.com/docs/manual/reference/operator/aggregation/lte/#example'
22
+ pipeline :
23
+ -
24
+ $project :
25
+ item : 1
26
+ qty : 1
27
+ qtyLte250 :
28
+ $lte :
29
+ - ' $qty'
30
+ - 250
31
+ _id : 0
Original file line number Diff line number Diff line change @@ -15,3 +15,17 @@ arguments:
15
15
name : expression2
16
16
type :
17
17
- expression
18
+ tests :
19
+ -
20
+ name : ' Example'
21
+ link : ' https://www.mongodb.com/docs/manual/reference/operator/aggregation/ne/#example'
22
+ pipeline :
23
+ -
24
+ $project :
25
+ item : 1
26
+ qty : 1
27
+ qtyNe250 :
28
+ $ne :
29
+ - ' $qty'
30
+ - 250
31
+ _id : 0
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace MongoDB \Tests \Builder \Expression ;
6
+
7
+ use MongoDB \Builder \Expression ;
8
+ use MongoDB \Builder \Pipeline ;
9
+ use MongoDB \Builder \Stage ;
10
+ use MongoDB \Tests \Builder \PipelineTestCase ;
11
+
12
+ /**
13
+ * Test $cmp expression
14
+ */
15
+ class CmpOperatorTest extends PipelineTestCase
16
+ {
17
+ public function testExample (): void
18
+ {
19
+ $ pipeline = new Pipeline (
20
+ Stage::project (
21
+ item: 1 ,
22
+ qty: 1 ,
23
+ cmpTo250: Expression::cmp (
24
+ Expression::numberFieldPath ('qty ' ),
25
+ 250 ,
26
+ ),
27
+ _id: 0 ,
28
+ ),
29
+ );
30
+
31
+ $ this ->assertSamePipeline (Pipelines::CmpExample, $ pipeline );
32
+ }
33
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace MongoDB \Tests \Builder \Expression ;
6
+
7
+ use MongoDB \Builder \Expression ;
8
+ use MongoDB \Builder \Pipeline ;
9
+ use MongoDB \Builder \Stage ;
10
+ use MongoDB \Tests \Builder \PipelineTestCase ;
11
+
12
+ /**
13
+ * Test $eq expression
14
+ */
15
+ class EqOperatorTest extends PipelineTestCase
16
+ {
17
+ public function testExample (): void
18
+ {
19
+ $ pipeline = new Pipeline (
20
+ Stage::project (
21
+ item: 1 ,
22
+ qty: 1 ,
23
+ qtyEq250: Expression::eq (
24
+ Expression::numberFieldPath ('qty ' ),
25
+ 250 ,
26
+ ),
27
+ _id: 0 ,
28
+ ),
29
+ );
30
+
31
+ $ this ->assertSamePipeline (Pipelines::EqExample, $ pipeline );
32
+ }
33
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace MongoDB \Tests \Builder \Expression ;
6
+
7
+ use MongoDB \Builder \Expression ;
8
+ use MongoDB \Builder \Pipeline ;
9
+ use MongoDB \Builder \Stage ;
10
+ use MongoDB \Tests \Builder \PipelineTestCase ;
11
+
12
+ /**
13
+ * Test $gt expression
14
+ */
15
+ class GtOperatorTest extends PipelineTestCase
16
+ {
17
+ public function testExample (): void
18
+ {
19
+ $ pipeline = new Pipeline (
20
+ Stage::project (
21
+ item: 1 ,
22
+ qty: 1 ,
23
+ qtyGt250: Expression::gt (
24
+ Expression::numberFieldPath ('qty ' ),
25
+ 250 ,
26
+ ),
27
+ _id: 0 ,
28
+ ),
29
+ );
30
+
31
+ $ this ->assertSamePipeline (Pipelines::GtExample, $ pipeline );
32
+ }
33
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace MongoDB \Tests \Builder \Expression ;
6
+
7
+ use MongoDB \Builder \Expression ;
8
+ use MongoDB \Builder \Pipeline ;
9
+ use MongoDB \Builder \Stage ;
10
+ use MongoDB \Tests \Builder \PipelineTestCase ;
11
+
12
+ /**
13
+ * Test $gte expression
14
+ */
15
+ class GteOperatorTest extends PipelineTestCase
16
+ {
17
+ public function testExample (): void
18
+ {
19
+ $ pipeline = new Pipeline (
20
+ Stage::project (
21
+ item: 1 ,
22
+ qty: 1 ,
23
+ qtyGte250: Expression::gte (
24
+ Expression::numberFieldPath ('qty ' ),
25
+ 250 ,
26
+ ),
27
+ _id: 0 ,
28
+ ),
29
+ );
30
+
31
+ $ this ->assertSamePipeline (Pipelines::GteExample, $ pipeline );
32
+ }
33
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace MongoDB \Tests \Builder \Expression ;
6
+
7
+ use MongoDB \Builder \Expression ;
8
+ use MongoDB \Builder \Pipeline ;
9
+ use MongoDB \Builder \Stage ;
10
+ use MongoDB \Tests \Builder \PipelineTestCase ;
11
+
12
+ /**
13
+ * Test $lt expression
14
+ */
15
+ class LtOperatorTest extends PipelineTestCase
16
+ {
17
+ public function testExample (): void
18
+ {
19
+ $ pipeline = new Pipeline (
20
+ Stage::project (
21
+ item: 1 ,
22
+ qty: 1 ,
23
+ qtyLt250: Expression::lt (
24
+ Expression::numberFieldPath ('qty ' ),
25
+ 250 ,
26
+ ),
27
+ _id: 0 ,
28
+ ),
29
+ );
30
+
31
+ $ this ->assertSamePipeline (Pipelines::LtExample, $ pipeline );
32
+ }
33
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace MongoDB \Tests \Builder \Expression ;
6
+
7
+ use MongoDB \Builder \Expression ;
8
+ use MongoDB \Builder \Pipeline ;
9
+ use MongoDB \Builder \Stage ;
10
+ use MongoDB \Tests \Builder \PipelineTestCase ;
11
+
12
+ /**
13
+ * Test $lte expression
14
+ */
15
+ class LteOperatorTest extends PipelineTestCase
16
+ {
17
+ public function testExample (): void
18
+ {
19
+ $ pipeline = new Pipeline (
20
+ Stage::project (
21
+ item: 1 ,
22
+ qty: 1 ,
23
+ qtyLte250: Expression::lte (
24
+ Expression::numberFieldPath ('qty ' ),
25
+ 250 ,
26
+ ),
27
+ _id: 0 ,
28
+ ),
29
+ );
30
+
31
+ $ this ->assertSamePipeline (Pipelines::LteExample, $ pipeline );
32
+ }
33
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace MongoDB \Tests \Builder \Expression ;
6
+
7
+ use MongoDB \Builder \Expression ;
8
+ use MongoDB \Builder \Pipeline ;
9
+ use MongoDB \Builder \Stage ;
10
+ use MongoDB \Tests \Builder \PipelineTestCase ;
11
+
12
+ /**
13
+ * Test $ne expression
14
+ */
15
+ class NeOperatorTest extends PipelineTestCase
16
+ {
17
+ public function testExample (): void
18
+ {
19
+ $ pipeline = new Pipeline (
20
+ Stage::project (
21
+ item: 1 ,
22
+ qty: 1 ,
23
+ qtyNe250: Expression::ne (
24
+ Expression::numberFieldPath ('qty ' ),
25
+ 250 ,
26
+ ),
27
+ _id: 0 ,
28
+ ),
29
+ );
30
+
31
+ $ this ->assertSamePipeline (Pipelines::NeExample, $ pipeline );
32
+ }
33
+ }
You can’t perform that action at this time.
0 commit comments