Defer index creation #608
Replies: 3 comments 1 reply
-
One more piece of information here. Right now I'm getting stuck with a large legacy collection that has indexes created before. I cannot start Beanie with that collection because in Beanie's "init.py" there's a method init_indexes() and in there it tries to load existing indexes. HOWEVER - for whatever reason existing indexes have float direction in their BSON definition, not int. Now the pymongo helper tries to parse it and it fails. "skip_create_indexes" per collection / model would be of great help here. It fails there:
|
Beta Was this translation helpful? Give feedback.
-
Hi @svenvarkel, That's a great point. I will add this feature after the Pydantic v2 support. |
Beta Was this translation helpful? Give feedback.
-
Hey! Something new about this issue or the related PR? I need this... In development this wasn't cause me ant problem but when I went to production database the application doesn't have permissions to create indexes 😢 |
Beta Was this translation helpful? Give feedback.
-
Creating indexes should be deferred / made in the background (with asyncio.ensure_future, for example). In case of large collections creation of indexes takes a very long time (tens of minutes or even hours). The application bootstrap would be blocked for that time and this is really bad.
Thus I request a feature:
Beta Was this translation helpful? Give feedback.
All reactions