> For the complete documentation index, see [llms.txt](https://fivesobes.gitbook.io/nexorm/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fivesobes.gitbook.io/nexorm/operators/update-operators/array-operators/usdslicearray.md).

# $sliceArray

The $sliceArray operation is used to extract a portion of an array based on a specified range. It allows you to return a subset of elements by defining a start index and an optional count of elements to include. If a negative index is provided, it slices from the end of the array. This operation is useful when working with paginated data, trimming arrays to a specific length, or retrieving only a relevant portion of a dataset.

```typescript
await Member.$update({
    $where: { 
        age: { 
            $eq: 16 
        } 
    },
    $update: {
       $sliceArray: {
          badges: { $begin: 0, $end: 3 }
       }
    }
});
```
