Measure time of query in Mongo
The easiest way is to set the profiling level in MongoDB: https://docs.mongodb.org/manual/tutorial/manage-the-database-profiler/
Once you've done this, details on all of your queries will be logged to the system profile table.
Using Robo 3T and this worked for me in aggregation -
db.getCollection('product_verification').explain("executionStats").aggregate([{$match: {"company_id":1}},{$lookup: { "from": "product", "let": {"company": "$company_id", "code": "$item_code"}, "pipeline": [ {$match: {$expr: {$and: [ {"$eq": ["$company_id", "$$company"]}, {"$eq": ["$item_code", "$$code"]}, {"$in": ["$brand_uid",[13, 20]]} ]} }} ], "as": "details" }}])
And when using not aggregation
db.getCollection('product').find({name: "lenovo"}).explain("executionStats")