Let’s imagine I do have a collection of movies. Which have a tag with the movie genre.
I would like to find movies for the genre Horror and Comedy. However, I would like to prepend to find result 5 featured movies which are might not be Horror and Comedy.
So my collection will look like…
[featured1, featured2, featured3, Horror, Comedy, Horror, Horror...]
I know the IDS of featured movies and I would like the order of featured movies to be defined by the order of ids in the search query however the rest of the movies should be ordered by title.
At this moment I’m making to finds and I’m contacting results however this solution required a bunch of code to handle pagination correctly.
Is there any chance I can get this result in one find operation or somehow concat results of 2 find queries and get pagination not broken?
I’m using rustlang in the backend
Looks like elasticsearch have something like thishttps://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-pinned-query.html
Is the same thing possible in MongoDB?