我正在使用ruby和mongoid创建一个应用程序。但是当我尝试使用mongoid在任何集合中创建或查找文档时,我收到此错误
Mongo::Error::OperationFailure (not authorized on employee_production to execute command { find: "devices", filter: { token: null } } (13))
我在/etc/mongod.conf中启用了身份验证,并在mongoid.yml中添加了用户名和密码来验证mongodb连接。
development: clients: default: database: employee hosts: - localhost:27017 options: user: 'grapewine' password: '@)90GTWqks*' roles: - 'dbOwner' auth_mech: :scram auth_source: admin connect: :direct