insertAll

abstract suspend fun insertAll(sources: Iterable<InsertSource>): List<InsertOutcome>(source)

Inserts the documents of sources in order, reading each to its end (streams aren't closed). Small documents are logged in shared group commits, so bulk loads sync far less often than with one insert per document. Returns one outcome per source; a rejected document, or a replace that conflicts, doesn't stop the others. Any other error is thrown: documents whose outcome wasn't returned may or may not be visible.

Each source's InsertSource.types are assigned with its document as insert assigns them. They are checked for every source before any is read: an invalid path throws InvalidJsonPathException and an invalid name InvalidTypeNameException, and nothing is inserted.

A source with InsertSource.replaces is a replace: its outcome is InsertOutcome.Conflicted when one of the documents it replaces isn't visible, which includes one an earlier source of the call replaces or inserts.

In a store with a CreationOptions.documentKey, sources take effect in order, so a later source sees the keys of the earlier ones: with KeyConflict.FAIL a key an earlier source inserted conflicts, with KeyConflict.REPLACE the later source replaces it.