Increment `updatedAt` for nested schemas when setting a nested path in update
See original GitHub issuevar childSchema = new Schema({ name: String }, { timestamps: true });
var parentSchema = new Schema({ child: childSchema });
var Parent = mongoose.model('Parent', parentSchema);
// Should set `child.updatedAt` as well. Currently does not do so
Parent.update({}, { $set: { 'child.name': 'Luke' } });
Re: #4049
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:6
Top Results From Across the Web
add created_at and updated_at fields to mongoose schemas
The created_at field would be a date and only added when a document is created. The updated_at field would be updated with new...
Read more >timestamps schema option doesn't work on embedded ...
The mongoose timestamps schema option feature does not create a ... Increment updatedAt for nested schemas when setting a nested path in ......
Read more >Updating a nested object in a document using mongoose
I've been trying to update a particular object in a Mongodb document without any luck using the findOneAndUpdate() method.
Read more >Mongoose v6.8.2: API docs
Used for declaring paths in your schema that should be 128-bit decimal floating points. Do not use this to create a new Decimal128...
Read more >更新日志 · mongoose
fixed; Handle JSON.stringify properly for nested docs #2990 ... function to schemas required field #2247; added; support for setting updatedAt and createdAt ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for reporting the $push issue, will fix as well.
@MBayoumi please open up a separate issue with detailed code samples and what version of Mongoose you’re using.