I have two collections (Collection A and B) in one database. Collection A can be considered the main content and Collection B can be considered advertising which just needs to be mixed into the main feed every nth position. I want to make that single result set available through the GraphQL API which will receive search queries for the data (Collection A) and return the mixed result set (Collection A + B mixed in).
Can anyone advise where and how it is best to perform that merge?
I don’t want to $merge results into a new collection. That would just duplicate data and be something to keep in sync. I also need users to be able to search for pure content (Collection A only).
I also don’t want to $lookup. I’m not performing a join as there is nothing to join on. The two datasets are not related in any way. It’s just a case of placing adverts (Collection B) into a content stream (Collection A).
Would it be advisable to do this in a function for a custom resolver?
Any pointers appreciated.