upsert
abstract suspend fun upsert(source: InputStream, types: Map<String, String> = emptyMap()): DocId(source)
Inserts the JSON document read from source as insert does, in a store with a CreationOptions.documentKey, and deletes the visible document with the same key, if there is one, in the same atomic change (SPEC.md §3.3): once it's acknowledged the new document is visible and the old one deleted, and a crash leaves either both or neither. Of two upserts of one key, the one acknowledged last wins. Returns the new document's docId.
The key is read with the document, so a document without one is rejected with RejectReason.KEY_MISSING. A store without document keys throws IllegalStateException.
upsert with the document in the file path, opened and closed by the call.
upsert with the document given as a string; meant for small documents.