【发布时间】:2014-09-22 16:07:43
【问题描述】:
如何验证从 express.js 服务器到 mongo db 的每个查询?
我看了manage-the-database-profiler
我将配置文件级别设置为db.setProfilingLevel(2,200)。在我的页面上使用 mongoose 调用以下 mongo DB,如下所示
mycollection.findOne({MyId: 1}, function(err, data){
})
当我查看日志文件时,无法访问“mycollection”。 此外,日志文件有时确实包含对我的某些页面的查询,如下所示。
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
那么有什么方法可以将所有查询日志显示到 mongo 数据库?
【问题讨论】: