I have a sequence inside a document
{
errorTicker: [1,2,3,4,5,6,7,8,9]
}
I would like to do a group by N elements and get
for N = 3
{
errorTicker: [[1,2,3],[4,5,6],[7,8,9]]
}
What would have been ideal solution:
r.expr([1,2,3,4,5,6,7,8,9]).group(function(entry, index){
return r.expr(index).div(3).coerceTo('string').split('.')(0);
})
but group does not accept current index, only the entry being processed...
What magic could I use here to achieve the desired result?
P.S. order of the sequence is important to me i.e. group [1,2,3] is not the same as [1,3,5]