H
H
Hanry6542020-01-02 16:09:45
Node.js
Hanry654, 2020-01-02 16:09:45

Is it possible to update the document somehow in a similar way?

const User = {
    username: { isActive: true, value: 'qsd' },
    energy: {
      count: 5,
      date: 1609284531
    },
    right: 'user',

    _id: "5febbbb3dc6c99bc613331df"
  }

await userScheme.updateOne({ _id: User._id }, {
      User
    })

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DeityLamb, 2020-01-02
@Hanry654

await userScheme.findOneAndUpdate({ _id: user._id }, user);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question