Mainly putting this in here if someone is running into similar issues.
The collection objects on version 1.3.1 (most recent version pf pypi by the time of writing) throws a KeyError exception when one checks for document existence:
if my_key in db['my_collection']:
[...]
Intended behavior would imho be to gracefully return False if the document does not exist. This behavior seems to be already implemented in the more recent version 1.3.2. through a new __contains__ method on the Collection class. Resolving #105 would solve this issue.
A current workaround obviously is:
exists = True
try:
my_key in db['my_collection']
except KeyError:
exists: False
if exists:
[...]
Mainly putting this in here if someone is running into similar issues.
The collection objects on version 1.3.1 (most recent version pf pypi by the time of writing) throws a
KeyError
exception when one checks for document existence:Intended behavior would imho be to gracefully return
False
if the document does not exist. This behavior seems to be already implemented in the more recent version 1.3.2. through a new__contains__
method on theCollection
class. Resolving #105 would solve this issue.A current workaround obviously is:
Potentially related #113.