如何启用Mongojs Safe Option?

时间:2012-10-22 02:48:13

标签: node.js mongodb mongojs

考虑以下nodejs代码:

db = require('mongojs')('database', ['users, sessions']);
db.users.insert(
{
  'email': email,
  'password': password,
  'firstname': firstname,
  'lastname': lastname
}, 
function(err) {
  // will there ever be output?     
});

在这种情况下,mongodb是否启用安全模式输出错误?如果没有,我该如何启用它?

1 个答案:

答案 0 :(得分:0)

如果您指定回调,它会在Mongojs中自动启用。

https://github.com/gett/mongojs/blob/master/index.js#L168