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

[BUG] Order of elements in list[Link] is not preserved #930

Open
moonrail opened this issue May 6, 2024 · 0 comments
Open

[BUG] Order of elements in list[Link] is not preserved #930

moonrail opened this issue May 6, 2024 · 0 comments

Comments

@moonrail
Copy link

moonrail commented May 6, 2024

Describe the bug
As #414 and #527 were closed without any interaction by a stale bot (yay...) here another attempt.

When using DBRefs/Links, the ordering is stable when using MongoDB directly or any of its lower level libraries.

This is however not always the case with beanie.

Upon insert/update the order is preserved, as defined.

Upon link-fetching via e.g. fetch_links or fetch_all_links, it is not.

A possible solution can be found here: #414 (comment)
This just copies all Ids to a list with the original order and sorts the fetched documents later based on this order.

To Reproduce
Examples can be found in both older issues.

Expected behavior
Using fetch_all_links and fetch_links keeps the order of items as defined as DBRefs in the database.

Additional context

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

No branches or pull requests

1 participant