How to get middle of document?

How do I query by _id, BUT then I want to get 50 above and 50 below the document, sorted by a number age?

and bonus if I can get the index the elements based on the sort

Hi @Darren_Zou and welcome to MongoDB community forums!!

It’s great to see that a similar question has been asked on StackOverflow and that solutions have been provided to resolve the issue.

If those solutions don’t work for you, would you mind considering posting a comment on the thread requesting further clarification or updating on your progress?