Hi Marcus,
This is a tricky one.
Currently, the mongodb module is not available in the CoreSDK.
This will be fixed in the next release.
In the meantime you have to deploy your app to the cloud to use the module.
This is how the code looks like:
declare %an:sequential function s:execute($query as xs:string)
{
try {
r:eval-s($query)
} catch * {
{
res:set-status-code(500);
<error code="{$err:code}" description="{$err:description}"
module="{$err:module}" line-number="{$err:line-number}"
column-number="{$err:column-number}" />
}
}
};
Of course you can hardcode MongoDB queries directly but there is no way to test them locally at the moment.
If you pick the sandbox-style approach to get started, you can hide your mongodb credentials in a variable that you will reference in the query to be eval'd.
Does this help?
Kind regards,
William