我想记录每次查询时的查询时间。
我在 playframework 上使用 mongodb。只是我想减去开始和结束时间。例如:
a=currenttime();
madequert();
querytime=currenttime()-a;
有没有更好的办法?
我想记录每次查询时的查询时间。
我在 playframework 上使用 mongodb。只是我想减去开始和结束时间。例如:
a=currenttime();
madequert();
querytime=currenttime()-a;
有没有更好的办法?
您可能想使用Mongo 的 DB profiler。这样你就可以保留你的代码(维护它的工作更少),它会给你更多的选择来检查 Mongo 的行为。