0 votes
in MongoDB by
MongoDB – simulate join or subquery

1 Answer

0 votes
by

I’m trying to figure out the best way to structure my data in Mongo to simulate what would be a simple join or subquery in SQL.

Say I have the classic Users and Posts example, with Users in one collection and Posts in another. I want to find all posts by users who’s city is “london”.

I’ve simplified things in this question, in my real world scenario storing Posts as an array in the User document won’t work as I have 1,000’s of “posts” per user constantly inserting.

Related questions

+1 vote
+1 vote
asked Aug 15, 2022 in NoSQL by AdilsonLima
0 votes
asked Jan 7, 2023 in MongoDB by sharadyadav1986
...