BeanieODM / beanie

Asynchronous Python ODM for MongoDB
http://beanie-odm.dev/
Apache License 2.0
1.99k stars 211 forks source link

allow_index_dropping does not appear to work #282

Closed imakahn closed 1 year ago

imakahn commented 2 years ago

Hi @roman-right ,

Thank you for making this utility! It's been working great for us.

Apologies if I have misinterpreted how this property is meant to be used, but upon examination of the code it appears that index dropping is only attempted after index creation. Thus if there is a change/collision, the index dropping will never get to run

https://github.com/roman-right/beanie/blob/43e30661b57519331f7f5b1114bb8aa8e0f164e3/beanie/odm/settings/document.py#L128-L140

If I move the index dropping block above that of creation, I can modify indexes without any more conflicts/crashes.

Please let me know if the behavior is actually correct!

Thank you

roman-right commented 2 years ago

Hm. It looks like you are right. I need to add a collision checker before index creation. I drop extra indexes after creation to not reindex things on each app run. Thank you!

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity.

github-actions[bot] commented 1 year ago

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