Loading TOC...

admin.databaseValidateFieldPath

admin.databaseValidateFieldPath(
   config as element(configuration),
   database-id as (Number|String),
   field-path as element(db.fieldPath)
) as null

Summary

This function validates the specified field path. If the specified path is not valid, it throws an exception, otherwise it returns the empty sequence.

Parameters
config A configuration specification, typically as returned from one of the Admin module functions.
database-id The ID of the database (for example, xdmp:database("myDatabase")).
field-path The field path specification, typically the result of a call to admin:database-get-field-paths.

Example

const admin = require('/MarkLogic/admin.xqy');
var config = admin.getConfiguration()
var databaseid = xdmp.database("Documents")
var field = "myField"
var fieldPath =
   admin.databaseGetFieldPaths(config, databaseid, field)
admin.databaseValidateFieldPath(config, databaseid, fieldPath)

 //returns empty if the patha is OK, throws an exception if the path
 //is not valid 
    

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