0

I am trying to look up the data from another collection and updating the values but it is failing with the below error. And my query is like below .And I tried use multi:true but it is failing with the below error . Would appreciate any help

Error Details:

var values= db.getCollection("TestCollection").find({}).toArray()


    var modifiedCount = 0
    var bulk = db.getSiblingDB("Database").getCollection(targetCollection).initializeUnorderedBulkOp()
    
    values.forEach(value=>{
        bulk.find({
             system: 'values',
              'color': 'red',           
        })
        .update([{
            $set:{
                'Value.system':value.Type,                          
            }
        }])
        
        
    })

errmsg: 'multi update is not supported for replacement-style update',
          errInfo: undefined,
          op: {
            q: {
              system: 'values',
              'color': 'red',
             '
            },
            u: {
              '0': {
                '$set': {
                  'Value.system': 100,
                  
                }
              }
            },
            multi: true
          }
        }
      },
Rose
  • 89
  • 5
  • 18

0 Answers0