1.

What is localhost exception in MongoDB?

Answer»

MongoDB provides database profiler which captures and stores detailed information about commands executed on running instance. Captured details INCLUDE CRUD operations, administrative commands and configuration commands. The data collected by the profiler is stored in the system.profile collection in the admin database.

By default, the profile is turned off. We can enable it and set to different profiling levels based on the requirements. It provides 3 profiling levels:

  • 0 – Profiler OFF, no data collected, Default.
  • 1 – Profiler ON, data collected for operations taking time lower than slowms.
  • 2 – Profiler ON, data collected for all operations.

To capture the SLOW running queries, we can start the profiler with profiling level 1 or 2 and Default slow operation threshold is 100 milliseconds. We can CHANGE this threshold by specifying a slowms option.

Eg: To enable profiler which captures all queries slower than 50ms below command should be used:

db.setProfilingLevel(1, { slowms: 50 })


Discussion

No Comment Found