question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Increment `updatedAt` for nested schemas when setting a nested path in update

See original GitHub issue
var 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:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:6

github_iconTop GitHub Comments

1reaction
vkarpov15commented, Sep 12, 2016

Thanks for reporting the $push issue, will fix as well.

0reactions
vkarpov15commented, Sep 3, 2019

@MBayoumi please open up a separate issue with detailed code samples and what version of Mongoose you’re using.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found