I am taking the M220N class and we are building aggregations in VS Studio 2019. I am was working on a ticket that used $facets and I have a question that I would like to discuss.
My original post is M220N Advanced Reads. Please read this to get the background, but basically my question is:
My question is according to the original query:
movies = await _moviesCollection.Find<Movie>(Builders<Movie>.Filter.Empty)
.Sort(sortByYearDescending)
.Limit(moviesPerPage)
.Skip(pageNumber * moviesPerPage)
.ToListAsync();
The query will be called again when the page is incremented. This seems inefficient for applications that will have a lot of users executing paged searches.
In containerised or service based designs, is there a way to bring the original search into memory to avoid executing another query every time the page is incremented. It seems like poor optimisation and it can lead to system lag based on the number of queries executed.
Thoughts?