- Reference >
mongoShell Methods >- Database Methods >
- db.setProfilingLevel()
db.setProfilingLevel()¶
On this page
Definition¶
-
db.setProfilingLevel(level, slowms)¶ Modifies the current database profiler level used by the database profiling system to capture data about performance. The method provides a wrapper around the database command
profile.Parameter Type Description levelinteger Specifies a profiling level, which is either 0for no profiling,1for only slow operations, or2for all operations.slowmsinteger 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
slowmsoption to set the threshold for the profiler to consider a query “slow.” Specify this value in milliseconds to override the default.mongodwrites the output of the database profiler to thesystem.profilecollection.mongodprints information about queries that take longer than theslowmsto the log even when the database profiler is not active.