$slice operator not working as expected

Hello @Bojie_Xu,

Of course, it will give 10 elements if there are 10 elements from the 5th index because you have passed 10 in the third argument.
Can you check the total elements in dataArr using dataArrSize: { $size: "$dataArr"} in $project stage? As per your screenshot, the $group stage shows just 3 elements.

You can reproduce the issue in this playground also and share the link.

1 Like