Complete the code to enable authentication in MongoDB configuration.
security:
authorization: [1]Setting authorization to enabled turns on access control, requiring users to authenticate.
Complete the command to create a new user with readWrite role on the 'sales' database.
db.createUser({user: "salesUser", pwd: "password123", roles: [{ role: [1], db: "sales" }]})The readWrite role allows the user to read and write data in the specified database.
Fix the error in the command to enable TLS for MongoDB connections.
net:
tls:
mode: [1]Setting mode to requireTLS forces all connections to use TLS, securing data in transit.
Fill both blanks to configure MongoDB to bind only to localhost and enable authorization.
net: bindIp: [1] security: authorization: [2]
Binding to 127.0.0.1 restricts connections to the local machine. Enabling authorization requires users to authenticate.
Fill all three blanks to create a user with 'read' role on 'inventory' database and set password.
db.createUser({user: [1], pwd: [2], roles: [{ role: [3], db: "inventory" }]})The user is named inventoryUser with password invPass2024 and has the read role on the inventory database.