<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/xdmp.documentAddCollections.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>xdmp.documentAddCollections</api:function-name><api:suggest>xdmp.documentaddcollections</api:suggest><api:suggest>xdmp</api:suggest><api:suggest>documentaddcollections</api:suggest><api:function-link mode="xquery" fullname="xdmp:document-add-collections">/apidoc/8.0/xdmp:document-add-collections.xml</api:function-link><api:function mode="javascript" name="documentAddCollections" type="builtin" lib="xdmp" category="UpdateBuiltins" hidden="false" bucket="MarkLogic Built-In Functions" prefix="xdmp" namespace="http://marklogic.com/xdmp" fullname="xdmp.documentAddCollections"><api:summary>
  Adds the named document to the given collections.  For each collection
  that is protected, the user must have permissions to update that
  collection or have the <code xmlns="http://www.w3.org/1999/xhtml">any-collection</code> privilege.
  For each unprotected collection, the user must have the
  <code xmlns="http://www.w3.org/1999/xhtml">unprotected-collections</code> privilege.
</api:summary><api:params><api:param name="uri" type="xs:string"><api:param-description>
    The document URI.
  </api:param-description><api:param-name>uri</api:param-name><api:param-type>String</api:param-type></api:param><api:param name="collections" type="xs:string*"><api:param-description>
    A set of collection URIs.
  </api:param-description><api:param-name>collections</api:param-name><api:param-type>String[]</api:param-type></api:param></api:params><api:return>null</api:return><api:privilege>
 <p xmlns="http://www.w3.org/1999/xhtml">If adding an unprotected collection to a document, the
  <code>unprotected-collections</code> privilege
  (<code>http://marklogic.com/xdmp/privileges/unprotected-collections</code>)
  is needed; if adding a protected collection, the user must have either
  permissions to update the collection or the
  <code>any-collection</code> privilege
  (<code>http://marklogic.com/xdmp/privileges/any-collection</code>).
  </p>
</api:privilege><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
declareUpdate();
var colls=["http://examples.com", "http://marklogic.com"];
xdmp.documentAddCollections(
    "/example.xml", colls);
</pre></api:example></api:function></api:function-page>