I am creating an application using ruby and mongoid. But when I try to create or find a document in any collection using mongoid, i am getting this error
Mongo::Error::OperationFailure (not authorized on employee_production to execute command { find: "devices", filter: { token: null } } (13))
I have enabled authentication in /etc/mongod.conf and added username and password to mongoid.yml to authenticate mongodb connection.
development:
clients:
default:
database: employee
hosts:
- localhost:27017
options:
user: 'grapewine'
password: '@)90GTWqks*'
roles:
- 'dbOwner'
auth_mech: :scram
auth_source: admin
connect: :direct