Im使用npm mongodb
驱动程序和 node .
我有
collection.findOne({query}, function(err, result) {
//do something
}
问题是如果我没有任何结果,不管我是否找到结果,err
仍然是null
.我怎么知道查询中没有找到结果?
我也试过了
info = collection.findOne(....
但是info
只是undefined
(它看起来是异步的,所以我认为这不是一个好办法.)