junobuild_satellite

Function set_doc_store

Source
pub fn set_doc_store(
    caller: UserId,
    collection: CollectionKey,
    key: Key,
    value: SetDoc,
) -> Result<DocContext<DocUpsert>, String>
Expand description

Set a document in a collection’s store.

This function sets a document in a collection’s store based on the specified parameters. It returns a Result<DocContext<DocUpsert>, String> where Ok(DocContext) indicates successful insertion or update of the document, or an error message as Err(String) if the operation encounters issues.

§Parameters

  • caller: The UserId representing the caller initiating the operation.
  • collection: A CollectionKey representing the collection in which to set the document.
  • key: A Key identifying the document to be set.
  • value: An instance of SetDoc representing the document to be inserted or updated.

§Returns

  • Ok(DocContext<DocUpsert>): Indicates successful insertion or update of the document.
  • Err(String): An error message if the operation fails.

This function allows you to securely insert or update documents in a Juno collection’s store.