David Ennis (Clever Llamas) asked a question.

Documentation issue with MarkLogic 12 Javscript?

Hello my good friends at Progress.

 

Please see the following from the MarkLogic 12 documentation:

https://docs.progress.com/bundle/marklogic-server-javascript-reference-12/page/topics/language.html

 

Sample from the page:

  1. function* gen(limit){
  2. for (let i = 0; i < limit; i++)
  3. yield xdmp.eval('xs.dateTime(new Date())');}
  4. const result=[];
  5. for (const i of gen(10)){
  6. result.push(i);}
  7. result;
  8. /* returns ten different dateTime values (because they are each run
  9. in a separate eval) */

Now lets look at the known incompatibilities between the V8 engine in 12 and the previous version : https://docs.progress.com/bundle/marklogic-server-whats-new-12/page/topics/known-incompatibilities-with-previous-versions/between-marklogic-12-and-marklogic-11.html

 

Consider the sample about backwards compatibility showing how to write main modules in 12 (the export line):

  1. const result = {
  2. "hello": "world",
  3. "yourParam": external.myParam,
  4. "theDoc": external.doc
  5. }
  6. result
  7. export default result

With this in mind, I think that all of the samples in the main guide for 12 are incorrect and could make someone's head spin when they work in QC but return nothing as a main module.

 

Speaking of QC:

Example: https://docs.marklogic.com/12.0/cts.search

These will work in QC but not as main modules anymore (not that I see when someone would do that)