1> db.demo396.aggregate([
2... { "$lookup": {
3... "from": "demo395",
4... "let": { "details": "$details" },
5... "pipeline": [
6... { "$match": { "$expr": { "$in": [ "$_id", "$$details" ] } } }
7... ],
8... "as": "output"
9... }}
10... ])
1{ "_id" : ObjectId("5e5e787817aa3ef9ab8ab209"), "details" : [ ObjectId("5e5e782317aa3ef9ab8ab207"), ObjectId("5e5e782317aa3ef9ab8ab208") ], "output" : [ { "_id" : ObjectId("5e5e782317aa3ef9ab8ab207"), "Name" : "Chris" }, { "_id" : ObjectId("5e5e782317aa3ef9ab8ab208"), "Name" : "David" } ] }