admin.forestGetDatabase( config as element(configuration), forest-id as (Number|String) ) as (Number|String)?
This function returns the ID of the database that uses the specified forest.
http://marklogic.com/xdmp/privileges/admin/forest
http://marklogic.com/xdmp/privileges/admin/forest/{id}
const admin = require('/MarkLogic/admin.xqy'); const config = admin.getConfiguration() const forest = xdmp.forest("Documents") admin.forestGetDatabase(config, forest) //Returns the ID of the database that uses the Documents forest.