gpt4 book ai didi

node.js - 如何启用 Mongojs 安全选项?

转载 作者:太空宇宙 更新时间:2023-11-04 02:42:24 27 4
gpt4 key购买 nike

考虑以下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是否开启安全模式会输出错误?如果没有,我该如何启用它?

最佳答案

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

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

关于node.js - 如何启用 Mongojs 安全选项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13004413/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com