Extended $lookup

To be honest, I got here from here:

My initial query works really fast, but I need to find an alternative syntax for "idDevice": {"$in": db.devices.distinct("_id", {"group.$id": 11})} that it is JSON-compatible.