MongoDB Questions and Answers – Collection-Level Access Control

«
»

This set of MongoDB Multiple Choice Questions & Answers (MCQs) focuses on “Collection-Level Access Control”.

1. Administrators can implement collection-level access control through user-defined __________
a) roles
b) replica sets
c) shards
d) none of the mentioned
View Answer

Answer: a
Explanation: By creating a role with privileges that are scoped to a specific collection in a particular database, administrators can provision users with roles that grant privileges on a collection level.

advertisement

2. Point out the correct statement.
a) A rule consists of actions and the resources upon which the actions are permissible
b) Document-level access control allows developers to grant users privileges that are scoped to specific record
c) Each privilege action in a role can be scoped to a different record
d) None of the mentioned
View Answer

Answer: b
Explanation: Collection-level access control allows administrators to grant users privileges that are scoped to specific collections.

3. User can grant any role in the database to any user from any database in the system through _________ action.
a) grantRole
b) viewRole
c) killCursors
d) unlock
View Answer

Answer: a
Explanation: Apply this action to database resources.

4. User can remove any role from any user from any database in the system through _________
a) grantRole
b) viewRole
c) killCursors
d) revokeRole
View Answer

Answer: d
Explanation: User can view information about any role in the given database through viewRole.

5. Point out the wrong statement.
a) MongoDB uses the combination of the database name and the role name to uniquely define a role
b) A role consists of privileges that pair resources with not allowed operations
c) Roles grant users access to MongoDB resources
d) None of the mentioned
View Answer

Answer: d
Explanation: Except for roles created in the admin database, a role can only include privileges that apply to its database and can only inherit from other roles in its database.

advertisement

6. _________ terminates an operation as specified by the operation ID.
a) db.killOp()
b) db.kill()
c) db.remove()
d) none of the mentioned
View Answer

Answer: a
Explanation: Only use db.killOp() to terminate operations initiated by clients and do not terminate internal database operations.

7. Which of the following allows the user to view the information of any user in the given database?
a) createUser
b) viewUser
c) killCursors
d) all of the mentioned
View Answer

Answer: b
Explanation: To provide user administrators, MongoDB has userAdmin and userAdminAnyDatabase roles.

8. _________ deletes from a shard the orphaned documents whose shard key values fall into a single continuous range.
a) listallshards
b) cleanup
c) cleanupOrphaned
d) SelectIndexes
View Answer

Answer: c
Explanation: If two contiguous ranges do not belong to the shard, the cleanupOrphaned examines both ranges for orphaned documents.

9. Which of the following flushes user information from in-memory cache?
a) grantCache
b) invalidateUserCache
c) validateUserCache
d) none of the mentioned
View Answer

Answer: b
Explanation: invalidateUserCache allows you to purge the cache at any given moment, regardless of the interval set in the userCacheInvalidationIntervalSecs parameter.

10. __________ displays the cached query plans for the specified query shape.
a) CacheListPlans
b) displayCacheListPlans
c) planCacheListPlans
d) none of the mentioned
View Answer

Answer: b
Explanation: The query optimizer only caches the plans for those query shapes that can have more than one viable plan.

advertisement

Sanfoundry Global Education & Learning Series – MongoDB.

Here’s the list of Best Reference Books in MongoDB.

advertisement
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn