DocumentDB LogoDocumentDB
HomeGitHubDiscordDocsPackagesBlogs
Back to DocumentationMQL Documentation
Commands
Aggregation
Query And Write
Operators
Accumulators
Aggregation
Arithmetic Expression
Array Expression
Array Query
Array Update
Bitwise
Bitwise Query
Bitwise Update
Comparison Query
Conditional Expression
$cond
$ifNull
$switch
Data Size
Date Expression
Element Query
Evaluation Query
Field Update
Geospatial
Literal Expression
Logical Query
Miscellaneous
Miscellaneous Query
Object Expression
Projection
Set Expression
Timestamp Expression
Variable Expression
Window Operators
Reference/Operators/Conditional Expression

MongoDB Query Language (MQL) Conditional Expression Operators

Conditional expression operators provide control flow and conditional logic in expressions.

$cond

The $cond operator is used to evaluate a condition and return one of two expressions based on the result.

$ifNull

The $ifNull operator is used to evaluate an expression and return a specified value if the expression resolves to null.

$switch

The $switch operator is used to evaluate a series of conditions and return a value based on the first condition that evaluates to true.

Copyright © DocumentDB a Series of LF Projects, LLC. For web site terms of use, trademark policy and other project policies please see https://lfprojects.org.