Skip to content
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

Aggregation support via the find method #414

Open
EllieSapir opened this issue Feb 3, 2024 · 1 comment
Open

Aggregation support via the find method #414

EllieSapir opened this issue Feb 3, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@EllieSapir
Copy link

Feature request

Context

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

@EllieSapir EllieSapir added the enhancement New feature or request label Feb 3, 2024
@EllieSapir
Copy link
Author

I would like to contribute this feature, can you assign it to me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant