“Обновить мангуст” Ответ

Монгуз найти и обновить опору

var query = {'username': req.user.username};
req.newData.username = req.user.username;

MyModel.findOneAndUpdate(query, req.newData, {upsert: true}, function(err, doc) {
    if (err) return res.send(500, {error: err});
    return res.send('Succesfully saved.');
});
florinrelea

обновление мангуоза и вернуть новый

const query = {} //your query here
const update = {} //your update in json here
const option = {new: true} //will return updated document

const user = await User.findOneAndUpdate(query , update, option)
Graceful Gerenuk

Обновление мангуза

   Modelomodel
      .findOne({ Id: Id })
      .update(body)
      .exec()
Zarden

сохранение или обновление мангуза

// This will create another document if it doesn't exist
findByIdAndUpdate(_id, { something: 'updated' }, { upsert: true });
florinrelea

Обновить мангуст

const MyModel = mongoose.model('Test', new Schema({ name: String }));
const doc = new MyModel();

doc instanceof MyModel; // true
doc instanceof mongoose.Model; // true
doc instanceof mongoose.Document; // true
Adorable Anteater

Обновить мангуст

CommentaireArticleModel.update({ pseudo : 'Atinux'}, { pseudo : 'Nikita' }, { multi : true }, function (err) {
  if (err) { throw err; }
  console.log('Pseudos modifiés !');
});
Average Alligator

Ответы похожие на “Обновить мангуст”

Вопросы похожие на “Обновить мангуст”

Больше похожих ответов на “Обновить мангуст” по JavaScript

Смотреть популярные ответы по языку

Смотреть другие языки программирования