Open helgridly opened 11 months ago
Hey @helgridly, you're absolutely right that TinyDB's MemoryStorage
stores a reference, not a copy of the data that you insert. The correct solution to this would be to always create a deep copy of all data that is inserted to the database, but I'm somewhat conflicted as it also technically is a performance penalty for every write operation. Would it help to describe this behavior in the documentation, or do you think should be fixed on a deeper level?
obj
with a nested dictobj
's nested dictSee below:
I'm guessing somewhere the nested dict is being saved as a reference, not as a copy. I've confirmed it's not the query cache by setting it to zero.
This doesn't happen with normal JSON storage.