Skip to content

Support for 3.6+ $expr in queries #1824

Open
@chrisdejager

Description

@chrisdejager

I would love to be able to compare fields with each other in a query without needing to fall back on javascript in the where operator.

Since MongoDB 3.6+ we can use expressions within queries: https://docs.mongodb.com/v3.6/reference/operator/query/expr/
Example: db.monthlyBudget.find( { $expr: { $gt: [ "$spent" , "$budget" ] } } )

Using $expr instead of javascript would obviously perform better.

Is this planned for a future release?

Thanx!
Chris

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions