You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mads Hansen edited this page Jan 21, 2021
·
9 revisions
JavaScript modules are supported with Marklogic 8 or greater and can be used in place of an XQuery module. However, if returning multiple values (ex: URIS-MODULE), values must be returned as a ValueIterator. MarkLogic JavaScript API has helper functions to convert Arrays into ValueIterator: xdmp.arrayValues() and inserting values into another ValueIterator: fn.insertBefore().
JavaScript modules must have an .sjs file extension when deployed to a Modules database. However, adhoc JavaScript modules support both .sjs and .js file extensions.
For example, a simple URIS-MODULE may look like this: