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

Always use insert for time series documents #2728

Merged
merged 2 commits into from
Feb 7, 2025

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented Feb 7, 2025

Q A
Type bug
BC Break no
Fixed issues

Summary

This fixes an issue where assigning an ID to a time series document triggers an upsert, which is not allowed in time series collections. To work around this, we always use an insert command when inserting time series documents.

@alcaeus alcaeus added the Bug label Feb 7, 2025
@alcaeus alcaeus added this to the 2.10.1 milestone Feb 7, 2025
@alcaeus alcaeus requested a review from GromNaN February 7, 2025 09:03
Copy link
Member

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

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

The _id field can never be updated in MongoDB. Is this condition only when the document's id is set on an other field?

@alcaeus
Copy link
Member Author

alcaeus commented Feb 7, 2025

Typically, if you set an ID manually then ODM runs an upsert to ensure that you're not overwriting data. However, there is logic in DocumentPersister to ensure that the ID of the document does not change.

@alcaeus alcaeus merged commit a33bf09 into doctrine:2.10.x Feb 7, 2025
19 checks passed
@alcaeus alcaeus deleted the add-timeseries-tests branch February 7, 2025 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants