You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
engine.find allows full flexibility to query anything matching the read operation query syntax, via the *queries parameter, by allowing to pass QueryExpression along raw queries (dicts).
engine.find uses collection.aggregate internally, and therefore can allow an equal flexibility to use any aggregation stage matching the aggregation pipeline syntax
But, the function limits the use of aggregation stages to the ones defined explicitly via the function parameters: limit, sort, skip - for the $limit, $skip and $sort aggregation stages.
And *queries - which are used inside the $match aggregation stage.
Solution
Support all aggregation stages, with a new aggregations parameter.
Add the expressions in the aggregations parameter to the pipeline outside the $match stage.
For extra convenience, create AggregationQueryExpression, to support simple creation of aggregation stages.
Ones not implemented will be passed to aggregations as raw queries (dicts).
Add more aggregation operators as QueryExpression.
Alternative solutions
Implement the db.collection.find() method in engine.find, and create an engine.aggregate method for aggregations related operations.
Additional context
This will allow the user to use implemented odemantic functions for aggregation, reducing the need to use Raw query helpers
The text was updated successfully, but these errors were encountered:
Feature request
Context
engine.find
allows full flexibility to query anything matching the read operation query syntax, via the*queries
parameter, by allowing to passQueryExpression
along raw queries (dicts).engine.find
usescollection.aggregate
internally, and therefore can allow an equal flexibility to use any aggregation stage matching the aggregation pipeline syntaxBut, the function limits the use of aggregation stages to the ones defined explicitly via the function parameters:
limit, sort, skip
- for the $limit, $skip and $sort aggregation stages.And
*queries
- which are used inside the $match aggregation stage.Solution
Support all aggregation stages, with a new
aggregations
parameter.Add the expressions in the
aggregations
parameter to the pipeline outside the $match stage.For extra convenience, create
AggregationQueryExpression
, to support simple creation of aggregation stages.Ones not implemented will be passed to
aggregations
as raw queries (dicts).Add more aggregation operators as
QueryExpression
.Alternative solutions
Implement the
db.collection.find()
method inengine.find
, and create anengine.aggregate
method for aggregations related operations.Additional context
This will allow the user to use implemented odemantic functions for aggregation, reducing the need to use Raw query helpers
The text was updated successfully, but these errors were encountered: