How to update a list of documents in mongodb

0

I'm trying to update a list of objects look like this:

var lista = [ { _id: 57ea29361b297553c99d702f,
    nome: 'Meu nome',
    __v: 0 },
  { _id: 57ea29371b297553c99d7031,
    nome: 'Meu outro nome',
    __v: 0 } ]

model.update({}, lista)
        .then(function (result) {
            console.log(result);
        }, function (error) {
            console.log(error);
        });

But it returns me this:

  

{ok: 0, n: 0, nModified: 0}

If only one of the list works works

model.update({}, result[0])...
  

{ok: 1, nModified: 1, n: 1}

    
asked by anonymous 27.09.2016 / 10:18

0 answers