JavaScript: ValueIterator Replaced By Sequence
- Last Updated: April 14, 2026
- 1 minute read
- MarkLogic Server
- Version 11.0
- Documentation
The ValueIterator interface used to represent sequences of value in MarkLogic 8 has been replaced by the new Sequence interface. A Sequence is a JavaScript Iterable object. All functions which previously operated on or returned a ValueIterator now use a Sequence instead.
In many cases, this change is transparent to your code. However, code that depends on the following ValueIterator properties and methods must be changed:
-
ValueIterator.next- Use afor..ofloop to iterate over aSequence. Usefn.headif you just want to pick off the first or only value in a Sequence. -
ValueIterator.count- Usefn.countinstead. -
ValueIterator.clone- No longer needed. You can iterate over the sameSequencemultiple times.
For more details, see Sequence in the JavaScript Reference Guide and Sequence in the MarkLogic Server-Side JavaScript Function Reference.