I have a collection of 30000 documents of the form:
<_id:X src: 1 , dst:2}
<_id:X src: 1 , dst:3}
<_id:X src: 1 , dst:4}
<_id:X src: 1 , dst:5}
<_id:X src: 1 , dst:6}
<_id:X src: 1 , dst:7}
...
I transform this collection into the following form:
<_id: 1 , listOfNumbers:[2, 3, 4, 5, 6, 7}
<_id: 2 , dst:0}
<_id: 3 , dst:0}
<_id: 5 , dst:0}
<_id: 7 , dst:0}
<_id: 9 , dst:0}
...
I do this by using a MapReduce operation and the push method and it takes 12s to convert 10000 documents, 75s to convert 20000 documents.
Does anybody know how this could be done faster? Do indexes play a role here?
Thank you!