O
O
olezhenka2018-05-17 21:25:25
MongoDB
olezhenka, 2018-05-17 21:25:25

Why can't I replace a field in a mongoose document?

vk_account.save(function(err, vk_account) {
  if(err) return cb(err, null);
  vk_account.Sources = updated_sources;
  vk_account.settings = account_setting;
  cb(null, vk_account);
})

In vk_account.settings(Should be an Array in mongoose schema terms) I assign account_setting(Object). As a result, absolutely nothing changes in vk_account.settings.
I don't want to go against the mongoose schema system, I'm not going to save this document, I just want to replace one field with another and give the client the result.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question