MongoDB脚本获取update操作的影响记录数
来源:未知 责任编辑:责任编辑 发表时间:2013-12-18 11:37 点击:次
运行getlasterror可以获得最后一次操作影响的结果。
比如:
> db.display.update({$where: function() {return new Date().getTime() / 1000 - this.last_active_time > 300}, status: "offline"}, {$set: {status: "online"}}, false, true)
> db.runCommand("getlasterror")
{
"updatedExisting" : true,
"n" : 1495,
"connectionId" : 38,
"err" : null,
"ok" : 1
}
> var j = db.runCommand("getlasterror")
> j.n
1495
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 进入详细评论页>>






