MarkLogic 10 Product Documentation
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.databaseGetFieldPaths.

Example

const admin = require('/MarkLogic/admin.xqy');
const config = admin.getConfiguration()
const databaseid = xdmp.database("Documents")
const field = "myField"
const 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 
    
Powered by MarkLogic Server | Terms of Use | Privacy Policy