How to create a self join OR is it better to structure collections differently?

I have a requirement of maintaining similarity. For e.g. I have a collections of articles on various topics. For each document in my collection, I have an array of similar/related articles. Now I need to write a query that will - given an article ID, fetch all the documents from the same collection where the article ID is within the array of similar articles for the query parameter. Currently I can think of only 2 solutions:

  1. Find the document for given article ID and then use the similar article array in another find query to find IDs in fetched array of IDs
  2. Keep a separate collection of related articles and use $lookup to make a join

Is there a more efficient way to a. get everything in single find/aggregation AND b. avoid creating separate collection?

You are welcome to MongoDB Community @Vitthal_Kulkarni

There are lots of options for your data modelling. I will suggest this algorithm:

  1. create two collections; one for your article and the other to group the articles (article-group).
  2. Use one-to-many or many-to-many approaches to reference the article-group collection “objectids” in your article collection field. a pipeline to make a single query.

A simple specific example will have help to improve your idea.

Hope this help.
I am currently undergoing training at MongoDB online University. I recommend you do the same.