In this case $arrayElementAt returns only one element from a given position. If you want to manipulate a chunk of items you want to return you should use $slice. Please check the link for more references: MongoDB $slice
{ $slice: 3 } //for the first 3
{ $slice: -3 } //for the last 3
{ $slice: 2, 3 } //for 3 elements after skiping the 2 frist
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.