- db.setProfilingLevel(level, slowms)¶
Parameter Type Description level integer Specifies a profiling level, which is either 0 for no profiling, 1 for only slow operations, or 2 for all operations. slowms integer Optional. Sets the threshold in milliseconds for the profile to consider a query or operation to be slow.
The level chosen can affect performance. It also can allow the server to write the contents of queries to the log, which might have information security implications for your deployment.
Configure the slowOpThresholdMs option to set the threshold for the profiler to consider a query “slow.” Specify this value in milliseconds to override the default, 100ms.
mongod writes the output of the database profiler to the system.profile collection.
The database cannot be locked with db.fsyncLock() while profiling is enabled. You must disable profiling before locking the database with db.fsyncLock(). Disable profiling using db.setProfilingLevel() as follows in the mongo shell: