Skip and Limit on nested array element Skip and Limit on nested array element mongoose mongoose

Skip and Limit on nested array element


You can try like this -

db.collection.find({}, {ObjectArray:{$slice:[0, 3]}})

This will provide you records from 0..3

$slice:[SKIP_VALUE, LIMIT_VALUE]}

For your example:-

db.collection.find({"_id":""}, {ObjectArray:{$slice:[0, 3]}})

Here is the reference for MongoDB Slice feature.http://docs.mongodb.org/manual/reference/operator/projection/slice/