Skip to the content
hinny

Reference

upsert()

Insert a document or replace the document at the same key.

Parameters

Supply an integer key. Pass text as a string for a single text field or as a mapping of field names to strings. Optional attrs, vector, vectors, and sparse values must match the namespace schema.

Return value

Returns None. Subsequent queries see the write immediately.

Example

Python
docs.upsert(1, text="Sign the new lease", attrs={"kind": "task"})
print(docs.text(1)["body"])  # Sign the new lease