You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey there, finally starting to get my feet wet with this library.
I'm trying to use your wrapper for updating indices in the database, but the static method IndexManager.equal fails when attempting to delete ns from dbi:
"""Compares the specified ``index`` and ``db_index``.
This method return ``True`` if the ``index`` specification can be considered
equal to the existing ``db_index`` in the database.
"""
dbi=db_index.copy()
deldbi["v"]
deldbi["ns"]
returndbi==index.document# type: ignore
I don't think I'm doing anything special, just following the example from your tests. Sounds to me like the values just shouldn't be used for comparison and we can add an if "ns" in dbi: ... check beforehand?
Stack Trace
Traceback (most recent call last):
File "C:/projects/josxabot/app/modules/symbose/models/item.py", line 59, in <module>
asyncio.get_event_loop().run_until_complete(main())
File "c:\program files\python38\lib\asyncio\base_events.py", line 616, in run_until_complete
return future.result()
File "C:/projects/josxabot/app/modules/symbose/models/item.py", line 49, in main
await User.init_indexes(drop=True)
File "c:\users\int002327\appdata\local\pypoetry\cache\virtualenvs\josxabot-c3bmtbt9-py3.8\src\motor-odm\motor_odm\document.py", line 272, in init_indexes
await im.ensure_indexes(cls.__mongo__.indexes, drop=drop)
File "c:\users\int002327\appdata\local\pypoetry\cache\virtualenvs\josxabot-c3bmtbt9-py3.8\src\motor-odm\motor_odm\indexes.py", line 49, in ensure_indexes
elif self.equal(index, db_index):
File "c:\users\int002327\appdata\local\pypoetry\cache\virtualenvs\josxabot-c3bmtbt9-py3.8\src\motor-odm\motor_odm\indexes.py", line 100, in equal
del dbi["ns"]
File "C:\Users\INT002327\AppData\Local\pypoetry\Cache\virtualenvs\josxabot-c3BmTbt9-py3.8\lib\site-packages\bson\son.py", line 63, in __delitem__
self.__keys.remove(key)
ValueError: list.remove(x): x not in list
Kudos, I love the idea of combining Pydantic with... well... anything ;D
The text was updated successfully, but these errors were encountered:
Hey there, finally starting to get my feet wet with this library.
I'm trying to use your wrapper for updating indices in the database, but the static method
IndexManager.equal
fails when attempting to deletens
fromdbi
:Motor-ODM/motor_odm/indexes.py
Lines 91 to 101 in 15fdad8
I don't think I'm doing anything special, just following the example from your tests. Sounds to me like the values just shouldn't be used for comparison and we can add an
if "ns" in dbi: ...
check beforehand?Stack Trace
Kudos, I love the idea of combining Pydantic with... well... anything ;D
The text was updated successfully, but these errors were encountered: