Type Alias WriteStrategy

WriteStrategy: "merge" | "insertIfAbsent" | "insertDefaultIfAbsent"

Defines the various strategies available when inserting a document into a collection.

  • merge: the existing document will be merged with the document being inserted, if there is a pre-existing document.

  • insertIfAbsent: insert the document only if there is not already a document with the same ID in the store. If there is already a document in the store with the same ID then this will be a no-op.

  • insertDefaultIfAbsent: insert the document, with its contents treated as default data, only if there is not already a document with the same ID in the store. If there is already a document in the store with the same ID then this will be a no-op. Use this strategy if you want to insert default data for a given document ID, which you want to treat as common initial data amongst all peers and that you expect to be mutated or overwritten in due course.

Use DQL (Ditto Query Language) instead. For more information see: https://ditto.com/link/dql-legacy-to-dql-adoption