-
Type:
Bug
-
Resolution: Duplicate
-
Priority:
Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: Querying
-
ALL
When asking for just an array inside a dict, only that array is returned (good so far). However, when you ask for a slice of that array, other items in that dict are also returned.
> db.a.save({_id:1, vals: {first:[1,2,3,], second:[1,2,3]}})
> db.a.find()
{ "_id" : 1, "vals" :
}
> db.a.find({},{"vals.first":{$slice:2}})
{ "_id" : 1, "vals" :
}
//I would have expected this to work... might call that a bug.
> db.a.find({},{"vals.first":1, "vals.first":{$slice:2}})
{ "_id" : 1, "vals" :
}
> db.a.find({},{"vals":0, "vals.first":{$slice:2}})
{ "_id" : 1, "vals" :
}
(thanks skot on the #mongodb IRC channel for the example)
- duplicates
-
SERVER-3378 $slice projection returns all fields
-
- Closed
-