-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Description
Do you want to request a feature or report a bug?
Feature
What is the current behavior?
clone function falls back to valueOf, leading to a situation where valueOf may not give you the cloned value you seek.
If the current behavior is a bug, please provide the steps to reproduce.
See mongoosejs/mongoose-double#7 for background on the issue that lead to this ticket.
What is the expected behavior?
valueOf should return a clone but this is not always possible. Thus we need a method that we can seek and call to generate a proper clone
Suggest adding a cloneOf or clone method (similar to what is done for SchemaTypes) so we can support this would be great.
Per private email conversation with @vkarpov15
At first glance I think it is better to make Mongoose clone handle doubles without relying on valueOf as a clone. Please open up an issue in the mongoose GitHub repo.