Skip to content
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

fix(types): allow using an object to configure timestamps #12061

Conversation

lantw44
Copy link
Contributor

@lantw44 lantw44 commented Jul 7, 2022

Summary

This is a documented feature. Users should be able to configure
createdAt and updatedAt separately when making a query from TypeScript.

Examples

Allow code like this to compile:

const result = await Token.findOneAndUpdate(
  { uid },
  { $set: { field: value }, $setOnInsert: { createdAt: new Date('2022-01-01T00:00:00.000Z') } },
  { session, upsert: true, new: true, timestamps: { createdAt: false, updatedAt: true } },
).exec();

This is a documented feature. Users should be able to configure
createdAt and updatedAt separately when making a query from TypeScript.
Copy link
Collaborator

@vkarpov15 vkarpov15 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark results aren't great here, but I suspect that's due to #12037. WIll merge this 👍

@vkarpov15 vkarpov15 added this to the 6.4.4 milestone Jul 7, 2022
@vkarpov15 vkarpov15 merged commit 7e09c9b into Automattic:master Jul 7, 2022
@vkarpov15 vkarpov15 added the typescript Types or Types-test related issue / Pull Request label Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
typescript Types or Types-test related issue / Pull Request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants