Loading TOC...

MarkLogic 12 EA 2 Product Documentation
fn:exactly-one

fn:exactly-one(
   $arg as item()*
) as item()

Summary

Returns $arg if it contains exactly one item. Otherwise, raises an error [err:FORG0005].

For detailed type semantics, see Section 7.2.16 The fn:zero-or-one, fn:one-or-more, and fn:exactly-one functions[FS].

Parameters
arg The sequence of items.

Example

fn:exactly-one(("hello"))

=> "hello"

fn:exactly-one(("hello", "goodbye"))

=> XDMP-NOTONEITEM exception (because there are 2 items)

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