Database

db={"category":[{"_id":ObjectId("5fc0a6e58dc3892120595384"),"categoryName":"Tesla"},{"_id":ObjectId("5fc0a9258dc389212059538a"),"categoryName":"BMW"}],"car":[{"_id":801,"categoryId":ObjectId("5fc0a6e58dc3892120595384"),"name":"Model S","description":"This is model s"},{"_id":802,"categoryId":ObjectId("5fc0a9258dc389212059538a"),"name":"X1","description":"This is x1"},{"_id":803,"categoryId":ObjectId("5fc0a6e58dc3892120595384"),"name":"Model X","description":"This is model x"}]}

Query

db.category.aggregate([{$lookup:{from:"car",localField:"_id",foreignField:"categoryId",as:"cars"}}])

Result