we kunnen $objectToArray
. converteren en $slice
na 1 element in array
> db.io.aggregate(
[
{$addFields : {arr : {$objectToArray : "$$ROOT"}}},
{$project : { pass : {$slice : ["$arr.v", 1, 20 ] }}}
]
).pretty()
resultaat
{
"_id" : "[email protected]",
"pass" : [
123654,
235689,
"cccp123654",
"lhfrjy"
]
}
>