Replies: 1 comment
-
Seems like you're trying to update a document with a document ID of 0. But inserting a document into an empty database will assign the document ID 1, not 0, as the return value of >>> from tinydb import TinyDB, Query
>>> db = TinyDB('test.db')
>>> db.insert({})
1
>>> db.update({'name':'test'}, doc_ids=[1])
[1]
>>> db.all()
[{'name': 'test'}] |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello
I have issue updating empty entry, for example i create new empty entry:
db.insert({})
after it i would like to add some data:
db.update({'name':'test'}, doc_ids=[0])
I get KeyError, if i insert some value first it works fine.
Should it be so or i am not suppose to add empty entry?
Beta Was this translation helpful? Give feedback.
All reactions