Mongodb update+$or failed to update data accurately

  mongodb, question

Mongodb $update+$or cannot update data accurately
Use statement:

db.getCollection('test').update(
 {$or: [{c1:true, c2: true  }] } ,
 {$set: {rs:  true }},
 {multi:true}
 )

All three rows need to be updated, but only one row has been updated ($or is taken as $and)

图片描述

The data are as follows:

/* 1 */
 {
 "c1" : true
 }
 
 /* 2 */
 {
 "c2" : true
 }
 
 /* 3 */
 {
 "c1" : true,
 "c2" : true
 }

Wrong writing! Pay attention to the writing of or.

db.getCollection('test').update(
 {$or: [{c1:true}, {c2: true  }] } ,
 {$set: {rs:  true }},
 {multi:true}
 )