Answer the question
In order to leave comments, you need to log in
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
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 questionAsk a Question
731 491 924 answers to any question