Loading TOC...

xdmp:document-put-metadata

xdmp:document-put-metadata(
   $uri as xs:string,
   $metadata as map:map
) as empty-sequence()

Summary

Adds metadata to the document. If any key already exists in the document metadata, the new specified value replaces the old one. The string value of a non-string metadata value is used for persistence.

Parameters
$uri The document URI.
$metadata Metadata in the key value pairs to set on the document.

Example

xdmp:document-put-metadata(
    "foo.xml",map:map(
    <map:map xmlns:map=”http://marklogic.com/xdmp/map”>
      <map:entry key=”w”>
        <map:value>world</map:value>
      </map:entry>
      <map:entry key=”h”>
        <map:value>hello</map:value>
      </map:entry>
    </map:map>)))

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.

Comments

The commenting feature on this page is enabled by a third party. Comments posted to this page are publicly visible.
  • The Release Notes of MarkLogic-9 say that <blockquote>Storing the [bitemporal] axes times in metadata enables MarkLogic to update the axes timestamps without changing the documents and invoking reindexing.</blockquote> Thus it seems that metadata and metadata fields are not stored immutably in the stands like the term lists but somehow else. We would like to understand metadata to make use of it in the best way. Can you explain how metadata and how metadata fields are stored in MarkLogic? How do they interact with MVCC? Is the metadata stored similarly to the document timestamp? (the one mutable thing I can think of in disk stands) Would you agree that it makes sense to use metadata with metadata fields to persist often updated values, to reduce reindexing?