Fetch the value of column from previous row

The first thing is to have a search index that support the query if it is a regular use-case.

Documents don’t really have a position n. Even if they had, document at n-1 is not necessarily the document you want, it is if the symbol is the same, it is not if the symbol is $ne. You cannot know which document is the previous one unless you $match and $sort.