How long does it take to view a mongodb query

  mongodb, question

Operate mongodb on the command line.db.testrests.find({})If you want to know the time of this sentence, how do you check it?

1. Please use explain directly for find operation, for example:

db.tablename.find().explain( "executionStats" )
 
 Focus on the following values of output: explain.executionstates.executiontimemillis

2. For Update/delete/insert operations, please set the profile and view the log, for example:

db.setProfilingLevel(2)
 db.getProfilingLevel()
 
 db.system.profile.find()