'Where is the documentation for mongoose casting object to objectid?
I have a document where the type of field is set as an ObjectId. After some super confusing trials I realized that when doing
document.field = {"_id": ObjectId("6081c591524c4ad6686235c0"), "nosuchkey": "hello"}
mongoose will magically cat the object with the _id key into an ObjectId, as if I just did
document.field = ObjectId("6081c591524c4ad6686235c0")
but I can't find the documentation for this, or whether any such other tricks happen (I know about casting in queries, although casting for find, but not casting for aggregate with also a bit confusing). Can anyone point me in the right direction?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
