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: set createdAt timestamp field value on collection insert if not exists #303

Conversation

akhill10
Copy link
Contributor

Describe your changes

  • Added a check, if the gRPC insert response does not contain the createdAt timestamp field value then add those respective field values from the response metadata or else ignore.
  • Identified createdAt timestamp fields with the help of DecoratorMetaStorage for the specific collection.

/claim #245

How best to test these changes

  • Added the individual test cases for this scenario.

Issue ticket number and link

Fixes #245

const collectionCreatedAtFieldNames = collectionFields.filter((field) => {
return field?.schemaFieldOptions?.timestamp === "createdAt";
}).map(f => f.name);

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for addressing the issue @akhill10 . We can cache the collectionCreatedAtFieldNames at instantiation in constructor. That will significantly improve the performance. We will be good to merge this then.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good suggestion. We can tackle that in a separate PR.

@ovaistariq
Copy link
Contributor

@akhill10 thank you for your contribution

@github-actions
Copy link

🎉 This PR is included in version 1.0.0-beta.45 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions
Copy link

github-actions bot commented May 9, 2023

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@reviewpad reviewpad bot added the small Pull request is small label May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released small Pull request is small
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Field with timetamp: "createdAt" not set on newly inserted document
3 participants