Hi @Roi_Bar ,
Can you share a typical test documents from those 2 collections ?
If somebody upvotes a question why would an answer be upvoted? Am I missing something?
Once I see the current schema I would need the most critical queries and I can tube it based on that.
In general, I would say that each topic/question should be a document and each top level answer should be a document, a reply on an inner answer might be embedded in my opinion.
Now they can all live in one collection meaning that a question document will have a “type” : “question” field and an answer will have an answer type. But if they both in the same collection and you have a question id in each answer document you can run one query for all threads in that question …
db.questionsAndAnswers.find({question_id : xxx }).sort({type : -1, timestamp : 1})
Thanks
Pavel