Modify a field of all documents

0

Greetings, I have a question about the update method.

TablaPTC.update({compGasto:"si"},{$set: {acumulado: "0"}});

Currently this is my method, and I'm not sure I have to change it to serve.

    
asked by AnesKampoz 17.01.2017 в 04:54
source

1 answer

2

Modify my update method like this:

TablaPTC.update({},{$set:{acumulado: 0}},{multi: true},function(err,result){
            if(err){console.log(err)}
        })

Adding the part of: ,{multi: true}, function(err,result){ if(err){console.log(err)} }) It started working.

    
answered by 17.01.2017 в 05:48