Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

patch if else use

Documents.update(
    {some_condition: true}, 
    {$set: {"status": 
        {$cond: 
              {if  : {"some field": "some condition"}},
              {then:  "value 1"} ,
              {else: "value 2"} 
        } 
    }} 
)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #patch
ADD COMMENT
Topic
Name
6+8 =