Node.js Client API: valuesBuilder.slice is Now Zero-Based
- Last Updated: April 14, 2026
- 1 minute read
- MarkLogic Server
- Version 11.0
- Documentation
Previously, the slice clause on values queries (valuesBuilder.slice) accepted a one-based starting position and a page length:
slice(oneBasedStart,PageLength)
As Node.js Client API v2.0.3, the valuesBuilder.slice clause behaves like Array.prototype.slice. That is, it takes a zero-based starting position and the (zero-based) position after the last result to be retrieved. For example, the following slice call returns the first 5 results:
... .slice(0,5) ...
To restore the legacy behavior, use marklogic.setSliceMode. Note, however, that this form is deprecated and will be removed in a later release.