Loading TOC...

admin.databasePathReference

admin.databasePathReference(
   $scalar-type as String,
   $pathexpr as String,
   $collation as String?
) as element(db.pathReference)

Summary

This function creates a db:path-reference specification.

Parameters
$scalar-type A valid type for the range index. Must be one of: int, unsignedInt, long, unsignedLong, float, double, decimal, dateTime, time, date, gYearMonth, gYear, gMonth, gDay, yearMonthDuration, dayTimeDuration, string, anyURI, or point.
$pathexpr The path expression for the index. The should path should return true from cts:valid-index-path.
$collation The collation URI (for example, http://marklogic.com/collation/). The collation is only needed for string and anyURI indexes; for other indexes, specify the empty string ("") for this parameter.

Example

const admin = require('/MarkLogic/admin.xqy');
admin.databasePathReference("int", "/my/path[a=1]", "")
=>

<pathReference xmlns="http://marklogic.com/xdmp/database">
	<scalarType>int</scalarType>
	<pathExpression>/my/path[a=1]</pathExpression>
	<collation/>
</pathReference>

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