Skip to content

Commit 7e64509

Browse files
committed
Revert "add tests schema"
This reverts commit 56a801b.
1 parent 56a801b commit 7e64509

File tree

288 files changed

+3302
-6092
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

288 files changed

+3302
-6092
lines changed

generator/config/accumulator/accumulator.yaml

Lines changed: 15 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# $schema: ../schema.json
22
name: $accumulator
3-
link: https://www.mongodb.com/docs/manual/reference/operator/aggregation/accumulator/
3+
link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/accumulator/'
44
type:
55
- accumulator
66
encode: object
@@ -52,14 +52,15 @@ arguments:
5252
- string
5353
description: |
5454
The language used in the $accumulator code.
55+
5556
tests:
5657
-
57-
name: Use $accumulator to Implement the $avg Operator
58-
link: https://www.mongodb.com/docs/manual/reference/operator/aggregation/accumulator/#use--accumulator-to-implement-the--avg-operator
58+
name: 'Use $accumulator to Implement the $avg Operator'
59+
link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/accumulator/#use--accumulator-to-implement-the--avg-operator'
5960
pipeline:
6061
-
6162
$group:
62-
_id: $author
63+
_id: '$author'
6364
avgCopies:
6465
$accumulator:
6566
init:
@@ -72,8 +73,7 @@ tests:
7273
function(state, numCopies) {
7374
return { count: state.count + 1, sum: state.sum + numCopies }
7475
}
75-
accumulateArgs:
76-
- $copies
76+
accumulateArgs: [ "$copies" ]
7777
merge:
7878
$code: |-
7979
function(state1, state2) {
@@ -87,33 +87,16 @@ tests:
8787
function(state) {
8888
return (state.sum / state.count)
8989
}
90-
lang: js
91-
schema:
92-
books:
93-
_id:
94-
types:
95-
-
96-
bsonType: Number
97-
title:
98-
types:
99-
-
100-
bsonType: String
101-
author:
102-
types:
103-
-
104-
bsonType: String
105-
copies:
106-
types:
107-
-
108-
bsonType: Number
90+
lang: 'js'
91+
10992
-
110-
name: Use initArgs to Vary the Initial State by Group
111-
link: https://www.mongodb.com/docs/manual/reference/operator/aggregation/accumulator/#use-initargs-to-vary-the-initial-state-by-group
93+
name: 'Use initArgs to Vary the Initial State by Group'
94+
link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/accumulator/#use-initargs-to-vary-the-initial-state-by-group'
11295
pipeline:
11396
-
11497
$group:
11598
_id:
116-
city: $city
99+
city: '$city'
117100
restaurants:
118101
$accumulator:
119102
init:
@@ -122,8 +105,8 @@ tests:
122105
return { max: city === userProfileCity ? 3 : 1, restaurants: [] }
123106
}
124107
initArgs:
125-
- $city
126-
- Bettles
108+
- '$city'
109+
- 'Bettles'
127110
accumulate:
128111
$code: |-
129112
function(state, restaurantName) {
@@ -132,8 +115,7 @@ tests:
132115
}
133116
return state;
134117
}
135-
accumulateArgs:
136-
- $name
118+
accumulateArgs: ['$name']
137119
merge:
138120
$code: |-
139121
function(state1, state2) {
@@ -147,22 +129,4 @@ tests:
147129
function(state) {
148130
return state.restaurants
149131
}
150-
lang: js
151-
schema:
152-
restaurants:
153-
_id:
154-
types:
155-
-
156-
bsonType: Number
157-
name:
158-
types:
159-
-
160-
bsonType: String
161-
city:
162-
types:
163-
-
164-
bsonType: String
165-
cuisine:
166-
types:
167-
-
168-
bsonType: String
132+
lang: 'js'
Lines changed: 19 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# $schema: ../schema.json
22
name: $addToSet
3-
link: https://www.mongodb.com/docs/manual/reference/operator/aggregation/addToSet/
3+
link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/addToSet/'
44
type:
55
- accumulator
66
- window
@@ -13,83 +13,35 @@ arguments:
1313
name: expression
1414
type:
1515
- expression
16+
1617
tests:
1718
-
18-
name: Use in $group Stage
19-
link: https://www.mongodb.com/docs/manual/reference/operator/aggregation/addToSet/#use-in--group-stage
19+
name: 'Use in $group Stage'
20+
link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/addToSet/#use-in--group-stage'
2021
pipeline:
21-
-
22-
$group:
23-
_id:
24-
day:
25-
$dayOfYear:
26-
date: $date
27-
year:
28-
$year:
29-
date: $date
30-
itemsSold:
31-
$addToSet: $item
32-
schema:
33-
sales:
22+
- $group:
3423
_id:
35-
types:
36-
-
37-
bsonType: Number
38-
item:
39-
types:
40-
-
41-
bsonType: String
42-
price:
43-
types:
44-
-
45-
bsonType: Number
46-
quantity:
47-
types:
48-
-
49-
bsonType: Number
50-
date:
51-
types:
52-
-
53-
bsonType: Date
24+
day:
25+
$dayOfYear:
26+
date: '$date'
27+
year:
28+
$year:
29+
date: '$date'
30+
itemsSold:
31+
$addToSet: '$item'
5432
-
55-
name: Use in $setWindowFields Stage
56-
link: https://www.mongodb.com/docs/manual/reference/operator/aggregation/addToSet/#use-in--setwindowfields-stage
33+
name: 'Use in $setWindowFields Stage'
34+
link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/addToSet/#use-in--setwindowfields-stage'
5735
pipeline:
5836
-
5937
$setWindowFields:
60-
partitionBy: $state
38+
partitionBy: '$state'
6139
sortBy:
6240
orderDate: 1
6341
output:
6442
cakeTypesForState:
65-
$addToSet: $type
43+
$addToSet: '$type'
6644
window:
6745
documents:
68-
- unbounded
69-
- current
70-
schema:
71-
cakeSales:
72-
_id:
73-
types:
74-
-
75-
bsonType: Number
76-
type:
77-
types:
78-
-
79-
bsonType: String
80-
orderDate:
81-
types:
82-
-
83-
bsonType: Date
84-
state:
85-
types:
86-
-
87-
bsonType: String
88-
price:
89-
types:
90-
-
91-
bsonType: Number
92-
quantity:
93-
types:
94-
-
95-
bsonType: Number
46+
- 'unbounded'
47+
- 'current'

generator/config/accumulator/avg.yaml

Lines changed: 14 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# $schema: ../schema.json
22
name: $avg
3-
link: https://www.mongodb.com/docs/manual/reference/operator/aggregation/avg/
3+
link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/avg/'
44
type:
55
- accumulator
66
- window
@@ -15,80 +15,31 @@ arguments:
1515
- resolvesToNumber
1616
tests:
1717
-
18-
name: Use in $group Stage
19-
link: https://www.mongodb.com/docs/manual/reference/operator/aggregation/avg/#use-in--group-stage
18+
name: 'Use in $group Stage'
19+
link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/avg/#use-in--group-stage'
2020
pipeline:
21-
-
22-
$group:
23-
_id: $item
21+
- $group:
22+
_id: '$item'
2423
avgAmount:
2524
$avg:
2625
$multiply:
27-
- $price
28-
- $quantity
26+
- '$price'
27+
- '$quantity'
2928
avgQuantity:
30-
$avg: $quantity
31-
schema:
32-
sales:
33-
_id:
34-
types:
35-
-
36-
bsonType: Number
37-
item:
38-
types:
39-
-
40-
bsonType: String
41-
price:
42-
types:
43-
-
44-
bsonType: Number
45-
quantity:
46-
types:
47-
-
48-
bsonType: Number
49-
date:
50-
types:
51-
-
52-
bsonType: Date
29+
$avg: '$quantity'
5330
-
54-
name: Use in $setWindowFields Stage
55-
link: https://www.mongodb.com/docs/manual/reference/operator/aggregation/avg/#use-in--setwindowfields-stage
31+
name: 'Use in $setWindowFields Stage'
32+
link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/avg/#use-in--setwindowfields-stage'
5633
pipeline:
5734
-
5835
$setWindowFields:
59-
partitionBy: $state
36+
partitionBy: '$state'
6037
sortBy:
6138
orderDate: 1
6239
output:
6340
averageQuantityForState:
64-
$avg: $quantity
41+
$avg: '$quantity'
6542
window:
6643
documents:
67-
- unbounded
68-
- current
69-
schema:
70-
cakeSales:
71-
_id:
72-
types:
73-
-
74-
bsonType: Number
75-
type:
76-
types:
77-
-
78-
bsonType: String
79-
orderDate:
80-
types:
81-
-
82-
bsonType: Date
83-
state:
84-
types:
85-
-
86-
bsonType: String
87-
price:
88-
types:
89-
-
90-
bsonType: Number
91-
quantity:
92-
types:
93-
-
94-
bsonType: Number
44+
- 'unbounded'
45+
- 'current'

0 commit comments

Comments
 (0)