Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Switch

Index

Properties

Properties

$switch: { branches: { case: any; then: any }[]; default: any }

Evaluates a series of case expressions. When it finds an expression which evaluates to true, $switch executes a specified expression and breaks out of the control flow.

see

https://docs.mongodb.com/manual/reference/operator/aggregation/switch/#mongodb-expression-exp.-switch

Type declaration

  • branches: { case: any; then: any }[]

    An array of control branch documents. Each branch is a document with the following fields:

    • $case
    • $then
  • default: any

    The path to take if no branch case expression evaluates to true.

    Although optional, if default is unspecified and no branch case evaluates to true, $switch returns an error.

Generated using TypeDoc