How do i query mongo for the list of all non-private blogs along with the private blogs of currently logged-in user.
Blog(collection):
_user_id: ref(User),
title: String,
body: String,
private: Boolean, default:false
I can get all the non-private blogs with this query:
Blog.find({_user_id: req.user}).where('private', false).exec();
But I also want to get all the blogs which are marked private only by this current logged-in user.
Is this thing even possible using single query. Do I have to rely on advance mongodb features like map-reduce / aggregate .
$or?