<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/fn.doc.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>fn.doc</api:function-name><api:suggest>fn.doc</api:suggest><api:suggest>fn</api:suggest><api:suggest>doc</api:suggest><api:function-link mode="xquery" fullname="fn:doc">/apidoc/8.0/fn:doc.xml</api:function-link><api:function mode="javascript" name="doc" type="builtin" lib="fn" category="SequenceBuiltins" bucket="W3C-Standard Functions" hidden="false" prefix="fn" namespace="http://www.w3.org/2005/xpath-functions" fullname="fn.doc"><api:summary>
  <p xmlns="http://www.w3.org/1999/xhtml">Returns the document(s) stored in the database at the specified 
  URI(s).</p>
  <p class="javascript" xmlns="http://www.w3.org/1999/xhtml">If you are only getting a single document (specifying a 
  single URI), you can use <code><a href="./cts.doc">cts.doc</a></code>
  instead (so you do not need to iterate through the ValueIterator to
  get to the document).</p>
</api:summary><api:params><api:param name="uri" type="String | String[] | ValueIterator" optional="true" class="javascript"><api:param-description>
  The URI of the document to retrieve.  If you omit this parameter,
  returns all of the documents in the database. If you specify an array or
  a ValueIterator of URIs, returns all of the documents at the URIs 
  specified in the list.
  </api:param-description><api:param-name>uri</api:param-name><api:param-type>String | String[] | ValueIterator</api:param-type></api:param></api:params><api:return>ValueIterator</api:return><api:usage>
  The <code xmlns="http://www.w3.org/1999/xhtml">document-node()</code> returned for each item in the result
  contains an <code xmlns="http://www.w3.org/1999/xhtml">element()</code> root node for XML documents, a
  <code xmlns="http://www.w3.org/1999/xhtml">text()</code> root node for text documents, an 
  <code xmlns="http://www.w3.org/1999/xhtml">object-node()</code>, <code xmlns="http://www.w3.org/1999/xhtml">array-node()</code>, or another JSON node
  for a JSON document, and a <code xmlns="http://www.w3.org/1999/xhtml">binary()</code> root node for binary 
  documents.
</api:usage><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
var d = fn.doc("/mydocs/doc.json");
for (var x of d) {
x };

=&gt; The variable d holds a ValueIterator containing the document 
   at the URI /mydocs/doc.json, and x contains the document, so 
   this program returns the document.
</pre>
</api:example><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
var res = [];
var d = fn.subsequence(fn.doc(), 1, 2);
for (var x of d) {
res.push(x); };
res;

=&gt; The first 2 documents in the ValueIterator containing the documents
</pre>
</api:example></api:function></api:function-page>