Loading TOC...

MarkLogic 12 EA 2 Product Documentation
fn.collection

fn.collection(
   [uri as String[]]
) as Sequence

Summary

Returns all of the documents that belong to the specified collection(s).

Parameters
uri The URI of the collection to retrieve. If you omit this parameter, returns all of the documents in the database. If you specify a list of URIs, returns all of the documents in all of the collections at the URIs specified in the list.

Example

fn.head(fn.collection("mycollection"));
=> returns the first document in the "mycollection" collection

Example

const res = [];
const d = fn.subsequence(fn.collection("my-collection"), 1, 2);
for (const x of d) {
res.push(x); };
res;

=> The first 2 documents in the Sequence containing the collection

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