Loading TOC...

fn:doc

fn:doc(
   [$uri as xs:string*]
) as document-node()*

Summary

Returns the document(s) stored in the database at the specified URI(s).

Parameters
$uri The URI of the document to retrieve. If you omit this parameter, returns all of the documents in the database - this is only allowed if you're not using xquery version 1.0 strict. If you specify a list of URIs, returns all of the documents at the URIs specified in the list.

Usage Notes

The document-node() returned for each item in the result contains an element() root node for XML documents, a text() root node for text documents, an object-node(), array-node(), or another JSON node for a JSON document, and a binary() root node for binary documents.

Example

fn:doc("/mydocs/doc.xml")

=> returns the document at the URI /mydocs/doc.xml

Comments

  • Is it possible get document by URI and collection?
    • You can retrieve a document by URI with this function. To get documents by collection, see http://docs.marklogic.com/fn:collection or http://docs.marklogic.com/cts:collection-query.
Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy