【发布时间】:2016-07-12 21:51:44
【问题描述】:
你传入一个回调:
function(err, found) {
if(err)
// checks to see if there was an error
else if (found)
// checks if the document exists
}
“立即”执行查询。这是检查文档是否存在的正确方法吗?如何判断文档是否存在?如何判断执行查询是否出错(假设在数据库返回结果之前连接已丢失)。我只是有点困惑,不胜感激。
【问题讨论】: