04-20-2020 07:53 AM
If I want to compare two consecutive documents in an ordered stream (compare the current to the previous or next), is the best way to do that with array indexing functions in mappers/conditionals?
04-21-2020 06:51 PM
Here’s what I was thinking.
The GroupByN snap will group each 2 consecutive documents into a single document. Note this will group the first and second, third and fourth, and so on, but not the first and second, second and third, third and fourth. If you wanted to do a more complex grouping like the latter, you’d probably have to muck around with adding an index and joining.
From there, the example is pretty simple and shows how to use the Mapper to do some basic operations on the data.
Hopefully this is helpful.