I have 2 collections, I want to select the records from a collection according to another collection,
let me explain my mean by example:
Collection1:
id, user_id, completed
1 , 1 , true
2 , 1 , false
3 , 2 , true
4 , 3 , true
5 , 4 , false
Collection2:
id, username
1 , test
2 , test 2
3 , test 3
4 , test 4
I want to select users from collection2
which the completed
column in collection1
are false
(the result should be (1,test),(2,test 4) )
because I'm a newbie in MongoDB I don't know what should I do, I can do it in MySQL and PostgreSQL with join
but here what should I do?
I read the aggregation-pipeline in MongoDB documentation but I cannot figure out.