<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/xdmp.merge.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>xdmp.merge</api:function-name><api:suggest>xdmp.merge</api:suggest><api:suggest>xdmp</api:suggest><api:suggest>merge</api:suggest><api:function-link mode="xquery" fullname="xdmp:merge">/apidoc/8.0/xdmp:merge.xml</api:function-link><api:function mode="javascript" name="merge" type="builtin" lib="xdmp" category="UpdateBuiltins" hidden="false" bucket="MarkLogic Built-In Functions" prefix="xdmp" namespace="http://marklogic.com/xdmp" fullname="xdmp.merge"><api:summary>
  Starts merging the forests of the database, subject to specified
  options.  For any options that are not specified, their default values
  are used, not the values that are in the configuration files.
</api:summary><api:params><api:param name="options" type="(element()|map:map)?" optional="true"><api:param-description>
    The options 
                <span class="javascript" xmlns="http://www.w3.org/1999/xhtml">object</span>
    for this merge. The default value is
                
                <span class="javascript" xmlns="http://www.w3.org/1999/xhtml">null</span>
                .

    

    <p xmlns="http://www.w3.org/1999/xhtml">The 
           <code class="javascript">xdmp.merge</code>
           options include:</p>
    <blockquote xmlns="http://www.w3.org/1999/xhtml"><dl>
    <dt><p>
           <span class="javascript">mergeTimestamp</span>
           </p>
    </dt>
    <dd>Fragments with a timestamp of this or newer are not garbage collected
    during this merge.
    A negative value means the timestamp is relative to the time the merge
    starts, at ten million ticks per second.
    For example, -6000000000 means ten minutes before the merge.
    The default is 0, which means not specifying a timestamp.</dd>
    <dt><p>
           <span class="javascript">mergeMaxSize</span>
           </p></dt>
    <dd>The maximum allowable size, in megabytes, of a resultant stand. The
    default value is 32768 (32G).  A value of 0 means there is no limit. It is
    possible for a stand larger than the merge-max-size to merge if
    the stand has enough deleted fragments to trigger the merge min ratio; 
    in this case, MarkLogic will do a single-stand merge, merging out the 
    deleted fragments (even if the resulting stand is larger than the
    merge-max-size value specified).
    </dd>
    <dt><p>
           <span class="javascript">mergePriority</span>
           </p></dt>
    <dd>The CPU scheduler priority for the merge ("normal" or "lower").</dd>
    <dt><p>
           <span class="javascript">singleStand</span>
           </p></dt>
    <dd>If any forests in the database have a single stand and this parameter
    is false, do not merge them.  The default is <code>true</code>.
    </dd>
    <dt><p>
           <span class="javascript">forests</span>
           </p></dt>
    <dd>Specifies the IDs of the forests in which to perform merges.
    Each forest ID 
    is of type 
               <code class="javascript">string</code>.
    The default is to merge all of the forests in the database.</dd>
    </dl></blockquote>
  </api:param-description><api:param-name>options</api:param-name><api:param-type>Object?</api:param-type></api:param></api:params><api:return>null</api:return><api:privilege>
  <p xmlns="http://www.w3.org/1999/xhtml"><code>http://marklogic.com/xdmp/privileges/xdmp-merge</code></p>
</api:privilege><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
  xdmp.merge({
               "mergeMaxSize": 500,
               "mergeTimestamp": 8273,
               "singleStand": false,
               "forests": [
                 xdmp.forest("my-forest"),
                 xdmp.forest("my-other-forest")
               ]
             })
   =&gt; null

   Performs a merge on my-forest and my-other-forest.  If a stand
   created by this merge would be greater than 500 megabytes, the merge
   will be limited and not all stands will be merged (as many as can be
   merged under 500 MB will be merged).  If my-forest or my-other-forest
   have only one stand, they will not be merged.  Any fragments with
   timestamp 8273 or newer will not be garbage collected.
</pre></api:example></api:function></api:function-page>