Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifying documents returned by search modifies the query cache #516

Open
msiemens opened this issue Feb 25, 2023 Discussed in #515 · 0 comments
Open

Modifying documents returned by search modifies the query cache #516

msiemens opened this issue Feb 25, 2023 Discussed in #515 · 0 comments

Comments

@msiemens
Copy link
Owner

Discussed in #515

Originally posted by sakam0to February 23, 2023
A snippt codes

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant