How can I verify every query log from express.js server to mongo db?

How can I verify every query from express.js server to mongo db?

I looked manage-the-database-profiler I had set profile level as db.setProfilingLevel(2,200). At my page is calling following mongo DB using mongoose like following

mycollection.findOne({MyId: 1}, function(err, data){

    })

When I look log file, there's no access to "mycollection". Also, the log file sometime do contains query on some of my page like following.

2014-07-30T13:11:59.258-0700 [conn33] query myDB.myOtherCollection query: { MyID: 100 } planSummary: COLLSCAN ntoskip:0 nscanned:850 nscannedObjects:850 keyUpdates:0 numYields:7 locks(micros) r:6101 nreturned:0 reslen:20 3ms


So what is a way to show all query log to mongo database?

db.setProfilingLevel has an optional level argument that, when set to 2, records all operations in the system.profile collection of the database, not in the log file. The slowMS argument determines how slow a query must be before it is logged to the log file.

If you want to closely monitor activity in your collections, consider using MMS for monitoring as it exposes a lot of useful usage, performance, and profiling information in a more friendly format than system.profile.

If you were to set the second argument, slowMS, to 1ms, this will log all queries that take more than 1ms -- which is pretty much all of them.

Since you are using mongoose, you can see the queries executed by enabling debug.

mongoose.set('debug', true)