Database
db={"locations":[{"_id":"62de2eebefdaab015e668929","title":"New York"}],"users":[{"_id":"27de2ccbefdaab01545684a","name":"James Brown","location":["62de2eebefdaab015e668929"]}]}
Query
db.locations.aggregate([{"$lookup":{"from":"users","let":{id:"$_id"},"pipeline":[{"$match":{$expr:{"$in":["$$id","$location"]}}},{"$count":"userCount"}],"as":"userCount"}}])