Hi,

I'm using BaseX as a database for a web application with RESTXQ API endpoints. Each endpoint has a database name specified as a path param, for example:

declare
    %rest:GET
    %rest:path('data/{$database}/read')
function readData($database as xs:string) {
    let $doc := fn:doc($database || '/data.xml')
    return $doc
};

All of the queries inside the function are only run against a single database, but as described in the transaction management documentation, using fn:doc with a variable will lock all the databases. Is there any way around this? Any suggestions would be much appreciated.

Thanks!