If I want to update a specific key how would I do so? Why can't I do a direct update with dictionary methods?
db = TinyDB(sys.argv[1]) #assume empty
db.insert({'a':'1','b':'2'})
for record in db:
if True:
record['a'] = 2
print(db.all())
Output:
({'a':'1','b':'2'})
Expected:
({'a':'2','b':'2'})
While using Query()
may be useful, in the future I may have a lot of similar records and setting conditions for each key may be a hassle. I want to try to use the record itself as the condition and just change a single key.