mongo $slice query reverse index out of range
问题 The following query in mongo, behaves strange : db.items.findOne({},{ "List": { "$slice": [ skip, 3 ] }}) First: Instead of returning one object with ["_id","List"] keys only, it returns a full object. Second: if skip is negative and |skip| is higher than list.length then it returns the first three elements as though skip==0 I would expect for: { "_id" : ObjectId("542babf265f5de9a0d5c2928"), "List" : [ 1, 2, 3, 4, 5 ] "other" : "not_important" } query: db.items.findOne({},{ "List": { "$slice"