Florent Georges
Florent Georges

Reputation: 2327

Choose on which database to eval() on MarkLogic Node Client API

I am using the MarkLogic Node Client API, and would like to DatabaseClient.eval() some code on every database on the cluster. But as far as I can tell (and unlike xdmp.eval() or /v1/eval) it is not possible to set the content database against which to eval the code.

Did I miss anything?

Extra points for setting the modules database :-)

Upvotes: 2

Views: 39

Answers (1)

You should be able to set the database as part of constructing the client.

https://docs.marklogic.com/jsdoc/marklogic.html#.createDatabaseClient

In all cases, since you are using the xdmp.eval() endpoint, you already have some sharp tools available for the switching of any context (user, database, modules-database) by use of xdmp.invokeFunction() inside of your eval.

Upvotes: 2

Related Questions