mongodb 的 slow query log

mysql 玩久了,要跟 mongodb 當好朋友好像也不會太困難 XD

mongodb 的 profile :

用 db.getProfilingStatus() 知道目前的 profiling 狀態

用 db.setProfiling(n) 設定 level

Level Setting
-1 No change. Returns the current profile level.
0 Off. No profiling.
1 On. Only includes slow operations.
2 On. Includes all operations.


You may optionally set a threshold in milliseconds for profiling using the slowms option, as follows:

{ profile: 1, slowms: 200 }