Skip to content

Inconsistent results with non-existent doc_id #591

@alesbukovsky

Description

@alesbukovsky

TinyDB version: 4.8.2
Python version: 3.13.3

There is a difference in behavior when a non-existent doc_id is passed:

  • table.get(doc_id=N) returns None
  • table.update(doc_ids=[N]) raises KeyError exception
  • table.remove(doc_ids=[N]) raises KeyError exception

All method should have consistent results, i.e., either all raising an exception, or all returning a value (None or an empty list).

Also, the KeyError is generally not mentioned in the documentation for these operations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    contributions-welcomeHappy to accept pull requests for this issue

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions