Skip to main content

What's New in MarkLogic 11

Node.js Client API: valuesBuilder.slice is Now Zero-Based

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.