Development server:
I have two tables users and questions, user_id is stored in each question.
Unintentionally I have deleted some users, now I want delete questions for which the user doesn't exist,
delete from questions where q.id not in( select q.id from questions q inner join users u on u.id = q.user_id);
I think the above query does that in mysql but I want to do that in mongodb.
I am new to mongodb I know lookup aggregate function does the join but I don't how to do the above query.