Sunday, 23 April 2017

Loopback find and update in model array

I have a model for a project as follows:

{
  "name": "Project 1",
  "members":[{userId: 1, isAdmin: false}, {userId: 2, isAdmin: false}]
}

Using loopback (node.js server side code), how would I go about finding a project that has userId=1 and remove it from the array?

Project.updateAttributes({...?...},{...?...}, function(err,info){

})



via denislexic

No comments:

Post a Comment