I have 2 mongodb collections: "users" and "posts".
// users
{
_id,
username,
password,
privacy_level
}
// posts
{
_id,
user_id,
text,
timestamp
}
Is it possible to fetch all posts based on the user's privacy level ("public"). In SQL, I would do something like this:
SELECT
_id,
text,
timestamp
FROM
posts
JOIN
users
ON
posts.user_id = users._id
WHERE
users.privacy_level = 'public'
Is it possible to achieve this kind of query logic in mongodb?