“MONGODB $ PLAY” kodu Cevaplar

MONGODB $ PLAY
{ $pull: { : , : , ... } }

// The $pull operator removes from an existing array all instances
// of a value or values that match a specified condition.
$ PLOK MONGOOSE
TemplateDoc.findOneAndUpdate(
    { userId: _id },
    { $pull: { templates: { _id: templateid } } },
    { new: true }
  )
    .then(templates => console.log(templates))
    .catch(err => console.log(err));