Skip to content

Commit

Permalink
Refinement of query type with a new filter type
Browse files Browse the repository at this point in the history
  • Loading branch information
GromNaN committed Oct 11, 2023
1 parent 5bc3cd8 commit bdfbcc5
Show file tree
Hide file tree
Showing 85 changed files with 475 additions and 229 deletions.
11 changes: 8 additions & 3 deletions generator/config/expressions.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@
'returnType' => Type\ExpressionInterface::class,
'acceptedTypes' => [Type\ExpressionInterface::class, ...$bsonTypes['any']],
],
'filter' => [
'returnType' => Type\QueryFilterInterface::class,
'acceptedTypes' => [Type\QueryFilterInterface::class, ...$bsonTypes['any']],
],
'query' => [
'returnType' => Type\QueryInterface::class,
'acceptedTypes' => [Type\QueryInterface::class, ...$bsonTypes['object']],
Expand Down Expand Up @@ -112,6 +116,10 @@
'implements' => [ResolvesToAny::class],
'acceptedTypes' => ['string'],
],
'geometry' => [
'returnType' => Type\GeometryInterface::class,
'acceptedTypes' => [Type\GeometryInterface::class, ...$bsonTypes['object']],
],

// @todo add enum values
'Granularity' => [
Expand Down Expand Up @@ -155,7 +163,4 @@
'GeoPoint' => [
'acceptedTypes' => [...$bsonTypes['object']],
],
'Geometry' => [
'acceptedTypes' => [...$bsonTypes['object']],
],
];
2 changes: 1 addition & 1 deletion generator/config/query/all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category:
- 'Array Query Operators'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/all/'
type:
- query
- filter
encode: single
description: |
Matches arrays that contain all elements specified in the query.
Expand Down
2 changes: 1 addition & 1 deletion generator/config/query/bitsAllClear.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category:
- 'Bitwise Query Operators'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAllClear/'
type:
- query
- filter
encode: single
description: |
Matches numeric or binary values in which a set of bit positions all have a value of 0.
Expand Down
2 changes: 1 addition & 1 deletion generator/config/query/bitsAllSet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category:
- 'Bitwise Query Operators'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAllSet/'
type:
- query
- filter
encode: single
description: |
Matches numeric or binary values in which a set of bit positions all have a value of 1.
Expand Down
2 changes: 1 addition & 1 deletion generator/config/query/bitsAnyClear.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category:
- 'Bitwise Query Operators'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAnyClear/'
type:
- query
- filter
encode: single
description: |
Matches numeric or binary values in which any bit from a set of bit positions has a value of 0.
Expand Down
2 changes: 1 addition & 1 deletion generator/config/query/bitsAnySet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category:
- 'Bitwise Query Operators'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/bitsAnySet/'
type:
- query
- filter
encode: single
description: |
Matches numeric or binary values in which any bit from a set of bit positions has a value of 1.
Expand Down
2 changes: 1 addition & 1 deletion generator/config/query/box.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category:
- 'Geospatial Geometry Specifiers'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/box/'
type:
- query
- geometry
encode: single
description: |
Specifies a rectangular box using legacy coordinate pairs for $geoWithin queries. The 2d index supports $box.
Expand Down
2 changes: 1 addition & 1 deletion generator/config/query/center.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category:
- 'Geospatial Geometry Specifiers'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/center/'
type:
- query
- geometry
encode: single
description: |
Specifies a circle using legacy coordinate pairs to $geoWithin queries when using planar geometry. The 2d index supports $center.
Expand Down
2 changes: 1 addition & 1 deletion generator/config/query/centerSphere.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category:
- 'Geospatial Geometry Specifiers'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/centerSphere/'
type:
- query
- geometry
encode: single
description: |
Specifies a circle using either legacy coordinate pairs or GeoJSON format for $geoWithin queries when using spherical geometry. The 2dsphere and 2d indexes support $centerSphere.
Expand Down
2 changes: 1 addition & 1 deletion generator/config/query/elemMatch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category:
- 'Projection Operators'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/elemMatch/'
type:
- query
- filter
- projection
encode: object
description: |
Expand Down
2 changes: 1 addition & 1 deletion generator/config/query/eq.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category:
- 'Comparison Query Operators'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/eq/'
type:
- query
- filter
encode: single
description: |
Matches values that are equal to a specified value.
Expand Down
2 changes: 1 addition & 1 deletion generator/config/query/exists.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category:
- 'Element Query Operators'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/exists/'
type:
- query
- filter
encode: single
description: |
Matches documents that have the specified field.
Expand Down
2 changes: 1 addition & 1 deletion generator/config/query/expr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category:
- 'Evaluation Query Operators'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/expr/'
type:
- query
- filter
encode: single
description: |
Allows use of aggregation expressions within the query language.
Expand Down
4 changes: 2 additions & 2 deletions generator/config/query/geoIntersects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ category:
- 'Geospatial Query Selectors'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/geoIntersects/'
type:
- query
- filter
encode: single
description: |
Selects geometries that intersect with a GeoJSON geometry. The 2dsphere index supports $geoIntersects.
arguments:
-
name: geometry
type:
- Geometry
- geometry
4 changes: 2 additions & 2 deletions generator/config/query/geoWithin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ category:
- 'Geospatial Query Selectors'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/geoWithin/'
type:
- query
- filter
encode: single
description: |
Selects geometries within a bounding GeoJSON geometry. The 2dsphere and 2d indexes support $geoWithin.
arguments:
-
name: geometry
type:
- Geometry
- geometry
2 changes: 1 addition & 1 deletion generator/config/query/geometry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category:
- 'Geospatial Geometry Specifiers'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/geometry/'
type:
- query
- geometry
encode: object
description: |
Specifies a geometry in GeoJSON format to geospatial query operators.
Expand Down
2 changes: 1 addition & 1 deletion generator/config/query/gt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category:
- 'Comparison Query Operators'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/gt/'
type:
- query
- filter
encode: single
description: |
Matches values that are greater than a specified value.
Expand Down
2 changes: 1 addition & 1 deletion generator/config/query/gte.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category:
- 'Comparison Query Operators'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/gte/'
type:
- query
- filter
encode: single
description: |
Matches values that are greater than or equal to a specified value.
Expand Down
2 changes: 1 addition & 1 deletion generator/config/query/in.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category:
- 'Comparison Query Operators'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/in/'
type:
- query
- filter
encode: single
description: |
Matches any of the values specified in an array.
Expand Down
2 changes: 1 addition & 1 deletion generator/config/query/lt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category:
- 'Comparison Query Operators'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/lt/'
type:
- query
- filter
encode: single
description: |
Matches values that are less than a specified value.
Expand Down
2 changes: 1 addition & 1 deletion generator/config/query/lte.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category:
- 'Comparison Query Operators'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/lte/'
type:
- query
- filter
encode: single
description: |
Matches values that are less than or equal to a specified value.
Expand Down
2 changes: 1 addition & 1 deletion generator/config/query/maxDistance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category:
- 'Geospatial Geometry Specifiers'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/maxDistance/'
type:
- query
- filter
encode: single
description: |
Specifies a maximum distance to limit the results of $near and $nearSphere queries. The 2dsphere and 2d indexes support $maxDistance.
Expand Down
2 changes: 1 addition & 1 deletion generator/config/query/minDistance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category:
- 'Geospatial Geometry Specifiers'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/minDistance/'
type:
- query
- filter
encode: single
description: |
Specifies a minimum distance to limit the results of $near and $nearSphere queries. For use with 2dsphere index only.
Expand Down
2 changes: 1 addition & 1 deletion generator/config/query/mod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category:
- 'Evaluation Query Operators'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/mod/'
type:
- query
- filter
encode: array
description: |
Performs a modulo operation on the value of a field and selects documents with a specified result.
Expand Down
2 changes: 1 addition & 1 deletion generator/config/query/ne.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category:
- 'Comparison Query Operators'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/ne/'
type:
- query
- filter
encode: single
description: |
Matches all values that are not equal to a specified value.
Expand Down
4 changes: 2 additions & 2 deletions generator/config/query/near.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ category:
- 'Geospatial Query Selectors'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/near/'
type:
- query
- filter
encode: object
description: |
Returns geospatial objects in proximity to a point. Requires a geospatial index. The 2dsphere and 2d indexes support $near.
arguments:
-
name: geometry
type:
- Geometry
- geometry
-
name: maxDistance
type:
Expand Down
4 changes: 2 additions & 2 deletions generator/config/query/nearSphere.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ category:
- 'Geospatial Query Selectors'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/nearSphere/'
type:
- query
- filter
encode: object
description: |
Returns geospatial objects in proximity to a point on a sphere. Requires a geospatial index. The 2dsphere and 2d indexes support $nearSphere.
arguments:
-
name: geometry
type:
- Geometry
- geometry
-
name: maxDistance
type:
Expand Down
2 changes: 1 addition & 1 deletion generator/config/query/nin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category:
- 'Comparison Query Operators'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/nin/'
type:
- query
- filter
encode: single
description: |
Matches none of the values specified in an array.
Expand Down
3 changes: 2 additions & 1 deletion generator/config/query/not.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category:
- 'Logical Query Operators'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/not/'
type:
- query
- filter
encode: single
description: |
Inverts the effect of a query expression and returns documents that do not match the query expression.
Expand All @@ -13,3 +13,4 @@ arguments:
name: expression
type:
- query
- regex
2 changes: 1 addition & 1 deletion generator/config/query/polygon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category:
- 'Geospatial Geometry Specifiers'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/polygon/'
type:
- query
- geometry
encode: single
description: |
Specifies a polygon to using legacy coordinate pairs for $geoWithin queries. The 2d index supports $center.
Expand Down
10 changes: 0 additions & 10 deletions generator/config/query/positional.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion generator/config/query/regex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category:
- 'Evaluation Query Operators'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/regex/'
type:
- query
- filter
encode: single
description: |
Selects documents where values match a specified regular expression.
Expand Down
2 changes: 1 addition & 1 deletion generator/config/query/size.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category:
- 'Array Query Operators'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/size/'
type:
- query
- filter
encode: single
description: |
Selects documents if the array field is a specified size.
Expand Down
3 changes: 1 addition & 2 deletions generator/config/query/slice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
name: $slice
category:
- 'Projection Operators'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/slice/'
link: 'https://www.mongodb.com/docs/manual/reference/operator/projection/slice/'
type:
- query
- projection
encode: array
description: |
Expand Down
2 changes: 1 addition & 1 deletion generator/config/query/type.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category:
- 'Element Query Operators'
link: 'https://www.mongodb.com/docs/manual/reference/operator/query/type/'
type:
- query
- filter
encode: single
description: |
Selects documents if a field is of the specified type.
Expand Down
4 changes: 4 additions & 0 deletions generator/config/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
"projection",
"stage",
"query",
"filter",
"window",
"geometry",
"resolvesToAny",
"resolvesToNumber",
"resolvesToDouble",
Expand Down Expand Up @@ -110,6 +112,8 @@
"pipeline",
"window",
"expression",
"geometry",
"any",
"resolvesToNumber", "numberFieldPath", "number",
"resolvesToDouble", "doubleFieldPath", "double",
"resolvesToString", "stringFieldPath", "string",
Expand Down
Loading

0 comments on commit bdfbcc5

Please sign in to comment.