sec.getCompartments() as Sequence
This function returns a list of all of the compartments.
http://marklogic.com/xdmp/privileges/get-compartments
This function must be executed against the security database.
const sec = require('/MarkLogic/security.xqy'); sec.getCompartments()