Skip to content

Commit

Permalink
docs: add new upsert behavior information
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinNiederl authored and msiemens committed Jul 17, 2021
1 parent 3b93b4b commit b567d2a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,11 @@ This will update all users with the name John to have ``logged-in`` set to ``Tru
If no matching user is found, a new document is inserted with both the name set
and the ``logged-in`` flag.

To use the ID of the document as matching criterion a :class:`~tinydb.table.Document`
with ``doc_id`` is passed instead of a query:

>>> db.upsert(Document({'name': 'John', 'logged-in': True}, doc_id=12))

Retrieving data
...............

Expand Down

0 comments on commit b567d2a

Please sign in to comment.