Vikas
Vikas

Reputation: 985

Not able to update model in loopback

I am using updatingAll method in loopback but it is not working I am not able to understand the reason

I have written something like this

let data = {
      isActive: false
    };

      myModel
          .updateAll(data, {
            id: {
              inq: questionIds
            },
          });

Upvotes: 1

Views: 142

Answers (1)

vicbyte
vicbyte

Reputation: 3790

The order of parameters in updateAll seems to be incorrect. From documentation:

PersistedModel.updateAll([where], data, callback)

Also, it seems a callback function is required.

Callback function called with (err, info) arguments. Required.

So your call should look like this:

let data = {
    isActive: false
};
myModel.updateAll({
    id: {
        inq: questionIds
    },
}, data, (err, info) => null); //might want to add error checking to callback function

Upvotes: 2

Related Questions