-
Notifications
You must be signed in to change notification settings - Fork 575
Closed
Description
TinyDB version 2.0.1. My interpreter session:
from tinydb import TinyDB
db = TinyDB('my_existing_db.json')
len(db) # => 314
print db._last_id # => 99 (which is obviously wrong, as _get_next_id will return an existing id, messing with existing data)
Ids are actually sorted alphabetically.Table.init, so '99' is the last one. A workaround (albeit perhaps not the best one) is to replace line 191:
all_ids = sorted(self._read().keys())
by the following:
all_ids = sorted(self._read().keys(), key=int)
I find it strange I'm the first to notice this issue.
Metadata
Metadata
Assignees
Labels
No labels