'Mongoose timestamps aren't set or updated when using $set
I'm using Mongoose timestamps in my schema:
{ timestamps: true }
but then when I use $set on my document like so:
$set: {
"person.name": "Owen",
},
The timestamps (createdAt & updatedAt) aren't set or updated.
but when I use $set like so:
$set: {
person: {
name: "Owen"
}
}
then it does work.
Is this the expected behaviour? And is there anything I can do about it?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
