Get previous and next inside sub array in MongoDB
I have a database as below. [ { "title": "Data 1", "slug": "data-1", "sub_docs": [ { "name": "Sub Doc 1", "sub_slug": "sub-doc-1", "urls": [ "https://example.com/path-1", ] }, { "name": "Sub Doc 2", "sub_slug": "sub-doc-2", "urls": [ "https://example.com/path-2" ] }, {…