Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

case condition in mongodb

-- $switch has the following syntax:

{
   $switch: {
      branches: [
         { case: { $eq: [ 0, 5 ] }, then: "equals" },
         { case: { $gt: [ 0, 5 ] }, then: "greater than" },
         { case: { $lt: [ 0, 5 ] }, then: "less than" }
      ]
   }
}
Source by www.mongodb.com #
 
PREVIOUS NEXT
Tagged: #case #condition #mongodb
ADD COMMENT
Topic
Name
9+1 =