-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHPLIB-1254 Create Yaml for all operators and stages #1180
Closed
Closed
Changes from 2 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
6fe9809
Create Yaml files from Google Sheet
GromNaN 204e88f
Import all operators and stages
GromNaN b3c6279
Add @no-named-argument to list variadic
GromNaN 59f360c
Improve typing for variadics
GromNaN 64ee28e
Add link and description to classes and factory
GromNaN 05c5ee5
Temporary disable benchmarks and old PHP version from CI
GromNaN 83aa77a
Fix & encoding
GromNaN 9a36d17
Fix schema
GromNaN c0de34d
Introduce MongoDB\object() function
GromNaN 70f8671
Fix single encoding + optional value in array
GromNaN 38c7750
Fix psalm + accumulator
GromNaN 5733833
Case insensitive sort of methods
GromNaN 6faa7f8
Fix $sum accumulator test
GromNaN 27c9f21
Ignore psalm issues
GromNaN 502ed6b
Improve doc for object function
GromNaN 3f175e7
Fix methods order
GromNaN d89d024
Remove tests on PHP 8.0
GromNaN 2129f88
Rename mixed to any and remove incorrect generic type from list
GromNaN 06c5294
Improve operator classification and add all BSON types
GromNaN a5840c0
Rename Expression Operators and write architecture document
GromNaN 99e2266
Implement Regex factory
GromNaN 636aa4a
Remove generated warning on non-generated files
GromNaN 5bc3cd8
Add use function for generated code
GromNaN bdfbcc5
Refinement of query type with a new filter type
GromNaN c7bc14c
Move Projection operators to a dedicated namespace
GromNaN 35dbd63
Move Optional & Encode enum to the Type namespace
GromNaN 00b3cd3
Move Accumulator and Window operators in a dedicated namespace
GromNaN dd28e4a
Remove category from Yaml files and remove scrape command
GromNaN 58fd4d0
Add some errors for incorrect types
GromNaN 13d29a8
Rename filter to fieldQuery
GromNaN e51b16f
exclude accumulator from QA
GromNaN c0790e0
Make FieldPath implement ResolveToAny
GromNaN 960eaa4
Remove unused packages
GromNaN 120f530
Make operator classes read-only
GromNaN 57555b9
Add tests on Pipeline class
GromNaN fee0df6
Rename PhpObject enum
GromNaN ad48be4
Use BSON\Type and BSON\Javascript classes, remove duplicate resolveToInt
GromNaN File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# $schema: ../schema.json | ||
name: $abs | ||
category: | ||
- 'Arithmetic Expression' | ||
link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/abs/' | ||
type: | ||
- resolvesToNumber | ||
encode: single | ||
description: | | ||
Returns the absolute value of a number. | ||
arguments: | ||
- | ||
name: value | ||
type: | ||
- resolvesToNumber |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# $schema: ../schema.json | ||
name: $accumulator | ||
category: | ||
- Accumulators | ||
- 'Custom Aggregation Expression Operator' | ||
link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/accumulator/' | ||
type: | ||
- Accumulator | ||
encode: object | ||
description: | | ||
Defines a custom accumulator function. | ||
New in version 4.4. | ||
arguments: | ||
- | ||
name: init | ||
type: | ||
- string | ||
description: | | ||
Function used to initialize the state. The init function receives its arguments from the initArgs array expression. You can specify the function definition as either BSON type Code or String. | ||
- | ||
name: initArgs | ||
type: | ||
- resolvesToArray | ||
optional: true | ||
description: | | ||
Arguments passed to the init function. | ||
- | ||
name: accumulate | ||
type: | ||
- string | ||
description: | | ||
Function used to accumulate documents. The accumulate function receives its arguments from the current state and accumulateArgs array expression. The result of the accumulate function becomes the new state. You can specify the function definition as either BSON type Code or String. | ||
- | ||
name: accumulateArgs | ||
type: | ||
- resolvesToArray | ||
description: | | ||
Arguments passed to the accumulate function. You can use accumulateArgs to specify what field value(s) to pass to the accumulate function. | ||
- | ||
name: merge | ||
type: | ||
- string | ||
description: | | ||
Function used to merge two internal states. merge must be either a String or Code BSON type. merge returns the combined result of the two merged states. For information on when the merge function is called, see Merge Two States with $merge. | ||
- | ||
name: finalize | ||
type: | ||
- string | ||
optional: true | ||
description: | | ||
Function used to update the result of the accumulation. | ||
- | ||
name: lang | ||
type: | ||
- string | ||
description: | | ||
The language used in the $accumulator code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# $schema: ../schema.json | ||
name: $acos | ||
category: | ||
- 'Trigonometry Expression Operator' | ||
link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/acos/' | ||
type: | ||
- resolvesToDouble | ||
- resolvesToDecimal | ||
encode: single | ||
description: | | ||
Returns the inverse cosine (arc cosine) of a value in radians. | ||
arguments: | ||
- | ||
name: expression | ||
type: | ||
- resolvesToNumber | ||
description: | | ||
$acos takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1. | ||
$acos returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. | ||
By default $acos returns values as a double. $acos can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# $schema: ../schema.json | ||
name: $acosh | ||
category: | ||
- 'Trigonometry Expression Operator' | ||
link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/acosh/' | ||
type: | ||
- resolvesToDouble | ||
- resolvesToDecimal | ||
encode: single | ||
description: | | ||
Returns the inverse hyperbolic cosine (hyperbolic arc cosine) of a value in radians. | ||
arguments: | ||
- | ||
name: expression | ||
type: | ||
- resolvesToNumber | ||
description: | | ||
$acosh takes any valid expression that resolves to a number between 1 and +Infinity, e.g. 1 <= value <= +Infinity. | ||
$acosh returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. | ||
By default $acosh returns values as a double. $acosh can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# $schema: ../schema.json | ||
name: $add | ||
category: | ||
- 'Arithmetic Expression Operator' | ||
- 'Date Expression Operator' | ||
link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/add/' | ||
type: | ||
- resolvesToNumber | ||
- resolvesToDate | ||
encode: array | ||
description: | | ||
Adds numbers to return the sum, or adds numbers and a date to return a new date. If adding numbers and a date, treats the numbers as milliseconds. Accepts any number of argument expressions, but at most, one expression can resolve to a date. | ||
arguments: | ||
- | ||
name: expression | ||
type: | ||
- resolvesToNumber | ||
- resolvesToDate | ||
variadic: array | ||
description: | | ||
The arguments can be any valid expression as long as they resolve to either all numbers or to numbers and a date. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# $schema: ../schema.json | ||
name: $addToSet | ||
category: | ||
- Accumulators | ||
- 'Window Operator' | ||
link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/addToSet/' | ||
type: | ||
- Accumulator | ||
encode: single | ||
description: | | ||
Returns an array of unique expression values for each group. Order of the array elements is undefined. | ||
Changed in version 5.0: Available in the $setWindowFields stage. | ||
arguments: | ||
- | ||
name: expression | ||
type: | ||
- expression | ||
- fieldPath |
16 changes: 16 additions & 0 deletions
16
generator/config/aggregation-operators/allElementsTrue.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# $schema: ../schema.json | ||
name: $allElementsTrue | ||
category: | ||
- 'Set Expression Operator' | ||
link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/allElementsTrue/' | ||
type: | ||
- resolvesToBool | ||
encode: array | ||
description: | | ||
Returns true if no element of a set evaluates to false, otherwise, returns false. Accepts a single argument expression. | ||
arguments: | ||
- | ||
name: expression | ||
type: | ||
- resolvesToArray | ||
variadic: array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# $schema: ../schema.json | ||
name: $and | ||
category: | ||
- 'Boolean Expression Operator' | ||
link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/and/' | ||
type: | ||
- resolvesToBool | ||
encode: single | ||
description: | | ||
Returns true only when all its expressions evaluate to true. Accepts any number of argument expressions. | ||
arguments: | ||
- | ||
name: expression | ||
type: | ||
- expression | ||
- resolvesToBool | ||
- resolvesToNumber | ||
- resolvesToString | ||
- resolvesToNull | ||
variadic: array |
15 changes: 15 additions & 0 deletions
15
generator/config/aggregation-operators/anyElementTrue.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# $schema: ../schema.json | ||
name: $anyElementTrue | ||
category: | ||
- 'Set Expression Operator' | ||
link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/anyElementTrue/' | ||
type: | ||
- resolvesToBool | ||
encode: array | ||
description: | | ||
Returns true if any elements of a set evaluate to true; otherwise, returns false. Accepts a single argument expression. | ||
arguments: | ||
- | ||
name: expression | ||
type: | ||
- resolvesToArray |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# $schema: ../schema.json | ||
name: $arrayElemAt | ||
category: | ||
- 'Array Expression Operator' | ||
link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/arrayElemAt/' | ||
type: | ||
- resolvesToAnything | ||
encode: array | ||
description: | | ||
Returns the element at the specified array index. | ||
arguments: | ||
- | ||
name: array | ||
type: | ||
- resolvesToArray | ||
- | ||
name: idx | ||
type: | ||
- resolvesToInt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# $schema: ../schema.json | ||
name: $arrayToObject | ||
category: | ||
- 'Array Expression Operator' | ||
link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/arrayToObject/' | ||
type: | ||
- resolvesToObject | ||
encode: array | ||
description: | | ||
Converts an array of key value pairs to a document. | ||
arguments: | ||
- | ||
name: array | ||
type: | ||
- resolvesToArray |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# $schema: ../schema.json | ||
name: $asin | ||
category: | ||
- 'Trigonometry Expression Operator' | ||
link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/asin/' | ||
type: | ||
- resolvesToDouble | ||
- resolvesToDecimal | ||
encode: single | ||
description: | | ||
Returns the inverse sin (arc sine) of a value in radians. | ||
arguments: | ||
- | ||
name: expression | ||
type: | ||
- resolvesToNumber | ||
description: | | ||
$asin takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1. | ||
$asin returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. | ||
By default $asin returns values as a double. $asin can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# $schema: ../schema.json | ||
name: $asinh | ||
category: | ||
- 'Trigonometry Expression Operator' | ||
link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/asinh/' | ||
type: | ||
- resolvesToDouble | ||
- resolvesToDecimal | ||
encode: single | ||
description: | | ||
Returns the inverse hyperbolic sine (hyperbolic arc sine) of a value in radians. | ||
arguments: | ||
- | ||
name: expression | ||
type: | ||
- resolvesToNumber | ||
description: | | ||
$asinh takes any valid expression that resolves to a number. | ||
$asinh returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. | ||
By default $asinh returns values as a double. $asinh can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# $schema: ../schema.json | ||
name: $atan | ||
category: | ||
- 'Trigonometry Expression Operator' | ||
link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/atan/' | ||
type: | ||
- resolvesToDouble | ||
- resolvesToDecimal | ||
encode: single | ||
description: | | ||
Returns the inverse tangent (arc tangent) of a value in radians. | ||
arguments: | ||
- | ||
name: expression | ||
type: | ||
- resolvesToNumber | ||
description: | | ||
$atan takes any valid expression that resolves to a number. | ||
$atan returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. | ||
By default $atan returns values as a double. $atan can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# $schema: ../schema.json | ||
name: $atan2 | ||
category: | ||
- 'Trigonometry Expression Operator' | ||
link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/atan2/' | ||
type: | ||
- resolvesToDouble | ||
- resolvesToDecimal | ||
encode: array | ||
description: | | ||
Returns the inverse tangent (arc tangent) of y / x in radians, where y and x are the first and second values passed to the expression respectively. | ||
arguments: | ||
- | ||
name: 'y' | ||
type: | ||
- resolvesToNumber | ||
description: | | ||
$atan2 takes any valid expression that resolves to a number. | ||
$atan2 returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. | ||
By default $atan returns values as a double. $atan2 can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. | ||
- | ||
name: x | ||
type: | ||
- resolvesToNumber |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# $schema: ../schema.json | ||
name: $atanh | ||
category: | ||
- 'Trigonometry Expression Operator' | ||
link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/atanh/' | ||
type: | ||
- resolvesToDouble | ||
- resolvesToDecimal | ||
encode: single | ||
description: | | ||
Returns the inverse hyperbolic tangent (hyperbolic arc tangent) of a value in radians. | ||
arguments: | ||
- | ||
name: expression | ||
type: | ||
- resolvesToNumber | ||
description: | | ||
$atanh takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1. | ||
$atanh returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. | ||
By default $atanh returns values as a double. $atanh can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# $schema: ../schema.json | ||
name: $avg | ||
category: | ||
- Accumulators | ||
- 'Accumulators (in Other Stages)' | ||
- 'Window Operator' | ||
link: 'https://www.mongodb.com/docs/manual/reference/operator/aggregation/avg/' | ||
type: | ||
- resolvesToNumber | ||
- Accumulator | ||
encode: single | ||
description: | | ||
Returns an average of numerical values. Ignores non-numeric values. | ||
Changed in version 5.0: Available in the $setWindowFields stage. | ||
arguments: | ||
- | ||
name: expression | ||
type: | ||
- resolvesToNumber | ||
variadic: array |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove when the scrape command is removed.