“deleteone Mongoose” Respostas de código

Excluir mangusto

// Delete a user by username
app.delete('/users/:Username', (req, res) => {
  Users.findOneAndRemove({ Username: req.params.Username })
    .then((user) => {
      if (!user) {
        res.status(400).send(req.params.Username + ' was not found');
      } else {
        res.status(200).send(req.params.Username + ' was deleted.');
      }
    })
    .catch((err) => {
      console.error(err);
      res.status(500).send('Error: ' + err);
    });
});
Quaint Quelea

deleteone Mongoose

Tank.deleteOne({ size: 'large' }, function (err) {
  if (err) return handleError(err);
  // deleted at most one tank document
});
KubernetesDan

Respostas semelhantes a “deleteone Mongoose”

Perguntas semelhantes a “deleteone Mongoose”

Procure respostas de código populares por idioma

Procurar outros idiomas de código