I have a Mongodb schema that looks roughly like:
[
{
\"name\" : \"name1\",
\"instances\" : [
{
\"value\" : 1,
\"date\" : ISODate
No $unwind is needed here. You can use $push with $arrayElemAt to project the array value at requested index inside $group aggregation.
Something like
db.colname.aggregate(
[
{"$group":{
"_id":null,
"valuesatNthindex":{"$push":{"$arrayElemAt":["$instances",N]}
}}
},
{"$project":{"valuesatNthindex":1}}
])