-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
findOneAndReplace does not set timestamps #9951
Labels
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
Milestone
Comments
IslandRhythms
added
the
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
label
Feb 22, 2021
|
This was referenced Mar 12, 2021
Closed
2 tasks
vkarpov15
added a commit
that referenced
this issue
Mar 22, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Do you want to request a feature or report a bug?
Report a bug.
What is the current behavior?
I am calling
Model.findOneAndReplace()
on a model with timestamps enabled. The resulting documents have no timestamps. Addingtimestamps: true
has no effect.Calling
Model.findOneAndUpdate()
on the same model withoverwrite: true
results in correct timestamps, leading me to believe this issue is specific toModel.findOneAndReplace()
.If the current behavior is a bug, please provide the steps to reproduce.
I can't currently provide a standalone PR but I still wanted to get this report in, in case it's something obvious.
What is the expected behavior?
Insert or overwrite with timestamps, as this similar call does:
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Node.js 14.15.4, Mongoose 5.11.17, MongoDB 3.6.4 (MongoDB Atlas 4.4.3).
The text was updated successfully, but these errors were encountered: