-
Hi, if I have database structured in the form of Is there a way to do this in TinyDB? I notice if I insert Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@eliluong This sounds like the Basically, you pass a query and a document. If the query matches any document that's already in the database, it will update it using the document you gave it. If there is no result, it will insert the provided document as a new one. Does that work for you? |
Beta Was this translation helpful? Give feedback.
@eliluong This sounds like the
upsert
operator: https://tinydb.readthedocs.io/en/latest/usage.html#upserting-dataBasically, you pass a query and a document. If the query matches any document that's already in the database, it will update it using the document you gave it. If there is no result, it will insert the provided document as a new one.
Does that work for you?