Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The $expr
operator allows the use of aggregation expressions within the query language. This enables more complex queries by allowing field comparisons, arithmetic operations, and other expressions directly within the query. Use cases for $expr
include filtering documents based on computed values, comparing fields within the same document, and performing operations that would otherwise require a separate aggregation pipeline.
The basic syntax for using the $expr
operator is as follows:
{
$expr: { <expression> }
}
Description | |
---|---|
expression |
An aggregation expression that evaluates to a boolean. The expression can include field paths, arithmetic operations, logical operations, and more. |
- Review options for Migrating from MongoDB to Azure Cosmos DB for MongoDB (vCore)
- Read more about Feature compatibility with MongoDB