Unable to allow timestamps in the sub document when having _id field in the main document #13343
Closed
2 tasks done
Labels
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
Milestone
Prerequisites
Mongoose version
6.0.0
Node.js version
12.22.12
MongoDB server version
4.4.17
Typescript version (if applicable)
No response
Description
I explain this based on the code in Step to Reproduce. It throws an error when setting
timestamps: true
in the level 2 sub document (dimensions
) when having an_id
in root documentDataSchema
for thetags
field, regardless of the value. Here is the error:I understand that I can just disable the _id directly in the sub schema (
ImageShema
), but I think it's still an issue since it should allow disabling the _id that way as well, unless it's a known limitation. Not to mention, it actually still works ifdimensions
is an array (commented code).Steps to Reproduce
Expected Behavior
Should be able to have
timestamps: true
fordimensions
, no matter we set the_id
forImageSchema
in the schema itself or in the root schema declaration, as well as array or not array field.The text was updated successfully, but these errors were encountered: