如何在我的mongod.conf文件中添加身份验证,以便每次启动$this->slimObj->add(function ($request, $response, $next) {
$response = $response->withHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, DELETE');
$response = $next ($request, $response);
return $response;
});
守护程序时都不必指定run mongod --auth
?
答案 0 :(得分:0)
编辑/etc/mongod.conf
添加或查找security:
部分
并在其下方添加authorization: enabled
,如下所示:
security:
authorization: enabled
在没有--auth