-
HI, is there a more efficient way of finding duplicate entries other than outputting db.all() and iterating through the whole lot, please? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Hey @Damien455! One of the main goals of TinyDB is to be as small and simple as possible. Unfortunately, this means that there's no built-in way to check for duplicates. |
Beta Was this translation helpful? Give feedback.
-
Hello @Damien455, You've likely figured this out for yourself at some point over the last 2-3 months, but for fun and practice this afternoon I wrote a small program demonstrating an approach to identifying the The program does iterate through all the records in the database, but I see no way around that. If interested, see the Github repo at (https://github.com/therden/find_duplicate_TinyDB_records). |
Beta Was this translation helpful? Give feedback.
-
I'm glad, and you're welcome! |
Beta Was this translation helpful? Give feedback.
Hello @Damien455,
You've likely figured this out for yourself at some point over the last 2-3 months, but for fun and practice this afternoon I wrote a small program demonstrating an approach to identifying the
doc_id
of every TinyDB record that (other thandoc_id
value) has at least one doppelgänger in the same db file.The program does iterate through all the records in the database, but I see no way around that.
If interested, see the Github repo at (https://github.com/therden/find_duplicate_TinyDB_records).