from tinydb import TinyDB, Query
db = TinyDB("test.json")
db.insert({"id": 1})
q = Query()
records = db.search(q.id == 1)
records[0]["name"] = "N1"
db.search(q.id==1)
>>[{'id': 1, 'name': 'N1'}]
db.all()
>>[{'id': 1}]
You can see that modifications to the search function result affect the later search results. But it doesn't change the records on the disk. Is it expected or not?
Discussed in #515
Originally posted by sakam0to February 23, 2023
A snippt codes
You can see that modifications to the search function result affect the later search results. But it doesn't change the records on the disk. Is it expected or not?