Skip to content

Conversation

@bushig
Copy link

@bushig bushig commented Feb 28, 2025

What's New

  • Added smarter handling of array operations with state management. Now when you append to arrays, Beanie uses MongoDB's $push operator rather than replacing the entire array.
  • Also some changes to docs to make cleaner why one would use state manager.
  • fixture to check what operations was actually sent to Mongo by motor, instead of using get_changes.

More details

  • Array append() operations now generate MongoDB $push operations with state_management=True
  • Only happens when state_management_replace_objects=False (which is the default)
  • Other array operations (changing items, removing them) still work as before, cause they unsafe for sure.
  • The get_changes() method still shows the full array for compatibility

Also thinking about adding option for unsafe direct array operations like changing elements by index, but still evaluating if its worth it.

@bushig bushig force-pushed the support_list_append_in_state_manager branch from 15385bf to 88d6001 Compare March 3, 2025 09:38
@bushig bushig force-pushed the support_list_append_in_state_manager branch from 88d6001 to 126b258 Compare March 3, 2025 12:03
@bushig
Copy link
Author

bushig commented Mar 3, 2025

Fixed tests, but there is still two failing because of docker hub image pull limits and one seems to be flaky test
Can anyone rerun failing tests?

@staticxterm
Copy link
Member

Hi @bushig, thanks for the PR.
I'll rerun the tests. Which reminds me that I should push some PR that would hopefully fix those flaky tests.
When I get some free time, I'll take a look at the PR.

@github-actions
Copy link
Contributor

This PR is stale because it has been open 45 days with no activity.

@github-actions github-actions bot added the Stale label Apr 18, 2025
@github-actions
Copy link
Contributor

github-actions bot commented May 2, 2025

This PR was closed because it has been stalled for 14 days with no activity.

@github-actions github-actions bot closed this May 2, 2025
@staticxterm staticxterm reopened this May 14, 2025
@staticxterm staticxterm removed the Stale label May 14, 2025
@staticxterm staticxterm requested a review from a team May 14, 2025 18:06
@github-actions
Copy link
Contributor

This PR is stale because it has been open 45 days with no activity.

@github-actions
Copy link
Contributor

This PR is stale because it has been open 45 days with no activity.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 5, 2025

This PR is stale because it has been open 45 days with no activity.

@github-actions github-actions bot added the Stale label Oct 5, 2025
@staticxterm
Copy link
Member

@BeanieODM/beanie-devs is anyone willing to take a look at this PR? Although e.g. the data loss issue may still occur due to concurrent update from other processes, I believe this feature and the doc updates are worth merging.

@github-actions github-actions bot removed the Stale label Oct 7, 2025
@github-actions
Copy link
Contributor

This PR is stale because it has been open 45 days with no activity.

@github-actions
Copy link
Contributor

This PR is stale because it has been open 45 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants