C
C
chakaponi2019-04-12 13:42:33
MongoDB
chakaponi, 2019-04-12 13:42:33

How to prevent Mongodb from modifying the inserted object?

When an object is inserted into the database, a non-removable _id key is added to the original object. Is this behavior normal and how to get around it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
chakaponi, 2019-04-12
@chakaponi

Due to the fact that this behavior is not documented, and no one knows the answer to the question, I am forced to use a crutch, namely deep copying using Before using, you need to make sure that the crutch is suitable specifically for your case, since there are too critical " but" JSON.parse(JSON.stringify(a))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question