Skip to content
Studio 3T - The professional GUI, IDE and client for MongoDB
  • Tools
    • Aggregation Editor
    • IntelliShell
    • Visual Query Builder
    • Export Wizard
    • Import Wizard
    • Query Code
    • SQL Query
    • Connect
    • Schema Explorer
    • Compare
    • SQL ⇔ MongoDB Migration
    • Data Masking
    • Task Scheduler
    • Reschema
    • More Tools and Features
  • Solutions
  • Resources
    • Knowledge Base
    • MongoDB Tutorials & Courses
    • Tool/Feature Documentation
    • Blog
    • Community
    • Testimonials
    • Whitepapers
    • Reports
  • Contact us
    • Contact
    • Sales Support
    • Feedback and Support
    • Careers
    • About Us
  • Store
    • Buy Now
    • Preferred Resellers
    • Team Pricing
  • Download
  • My 3T
search

Studio 3T® Knowledge Base

  • Documentation
  • Tutorials
  • Workshops
Take the fastest route to learning MongoDB. Cover the basics in two hours with MongoDB 101, no registration required.
Start the free course

User Manager

Posted on: 24/02/2020 (last updated: 30/05/2022) by Thomas Zahn

User Manager, along with the Role Manager, simplifies MongoDB user management tasks like creating users and granting roles. Try both features today.

Basics

To open User Manager:

Grant roles to users by clicking the 'Users' button in the Global Toolbar
  • Button – Click on Users in the global toolbar
  • Right-click – Right-click on any target database in the Connection Tree and choose Manage Users

Create MongoDB user

  1. Open User Manager and click on Add.
  2. Enter the username.
  3. Enter the password. This is a required field.
  4. Grant the relevant roles by clicking on Grant Roles. They will populate the table under the Roles tab. Alternatively, remove a role by selecting it and clicking on Revoke Roles. Need to create a new role? Follow these steps.
  5. To add optional information about the user, use the Custom Data tab and insert it in JSON.
  6. Click on Validate JSON to ensure that the code is correct.
  7. Click on Add User.

Edit a user

  1. Open User Manager and select the user.
  2. Click on Edit to open the user profile and make changes as needed.
  3. Click on Update User.

With Studio 3T 2018.4, it’s now possible to view the JSON code behind the user creation by clicking on Show Code.

Delete a user

Select the user and click on Drop to delete the user from the list.

Grant MongoDB roles to a user

Choose the user and click on Grant Roles.

Manage MongoDB Roles and Users

Find the role by entering it in the text or choosing it from the list. Built-in roles will be marked by a yellow icon, custom roles by a green icon.

You can also click the combo-box at the top to choose from roles in other databases of your MongoDB instance, in case you want your new user to access other databases as well.

For our example, we will simply make our new user an administrator of their database and also grant them read-write access to it by selecting the roles dbOwner and readWrite.

When done, click the “Grant” button.

Grant roles to multiple users at once

In MongoDB, users are defined for specific databases. Each user is then assigned a list of roles that in turn define the user’s privileges.

Not surprisingly, MongoDB’s API therefore makes it easy to assign a user a list of roles via the grantRolesToUser method:

db.grantRolesToUser( "<username>", [ <roles> ], { <writeConcern> } )

However, MongoDB’s role API (http://docs.mongodb.org/v2.6/reference/method/js-role-management/) doesn’t directly cover another common use case where you want to assign a (maybe newly created) role or multiple roles to a list of users in one go.

With Studio 3T, you can grant roles to multiple users at once.

Let’s consider the following example. Say you have just created a new role “rwAdmin” on database “test” that makes users dbAdmins on that database and also let’s them read from and write to it. You now want to assign this new role and the existing role “userAdmin” to a group of users.

Connect to your MongoDB server as a user that has sufficient privileges to grant roles to users, select the database where your users are defined, and click the “Users” icon in the toolbar to open the user management tab for that database.

Grant roles to users by clicking the 'Users' button in the Global Toolbar

You will now see a list of all your users in the selected database. Simply select all users that you want to grant those roles to and click the “Grant Roles…” button.

Select the users you want to give roles to

Now, select from the list of available roles those that you want to grant to your list of selected users, and click “Grant”.

Et voilà 🙂  You can verify that those two roles were indeed granted to the group of selected users.

Verify the roles given to the users

Once you’re done granting roles, read more about how to set up user authentication or read more about the complementary Role Manager feature.


How helpful was this article?
This article was hideous
This article was bad
This article was ok
This article was good
This article was great
Thank you for your feedback!

About The Author

Thomas Zahn

Having grown up with a living room that was essentially the office of his mother’s software start-up in the 80s, Thomas is a dyed-in-the-wool software engineer. In the past, he has worked for large outfits such as Microsoft Research and Nokia as well as for specialised engineering shops and start-ups. He lives in Berlin with his wife and two kids, and loves tennis and hiking (though, bizarrely, he constantly seems to find no time to do much of either those two). Thomas holds a Ph.D. in Computer Science from the Freie Universität Berlin.

Article navigation

Related articles

  • Connection Manager
  • How to Connect to the License Manager Through a Proxy Server
  • Query Manager and Bookmarks
  • What’s New in Studio 3T 2020.4 | Introducing License Manager, IBM DB2 Migration Support, Export Wizard Improvements
  • What’s New in Studio 3T 2020.9 | Query Manager, Elapsed Time Indicator & More

Studio 3T

MongoDB Enterprise Certified Technology PartnerSince 2014, 3T has been helping thousands of MongoDB developers and administrators with their everyday jobs by providing the finest MongoDB tools on the market. We guarantee the best compatibility with current and legacy releases of MongoDB, continue to deliver new features with every new software release, and provide high quality support.

Find us on FacebookFind us on TwitterFind us on YouTubeFind us on LinkedIn

Education

  • Free MongoDB Tutorials
  • Connect to MongoDB
  • Connect to MongoDB Atlas
  • Import Data to MongoDB
  • Export MongoDB Data
  • Build Aggregation Queries
  • Query MongoDB with SQL
  • Migrate from SQL to MongoDB

Resources

  • Feedback and Support
  • Sales Support
  • Knowledge Base
  • FAQ
  • Reports
  • White Papers
  • Testimonials
  • Discounts

Company

  • About Us
  • Blog
  • Careers
  • Legal
  • Press
  • Privacy Policy
  • EULA

© 2023 3T Software Labs Ltd. All rights reserved.

  • Privacy Policy
  • Cookie settings
  • Impressum

We value your privacy

With your consent, we and third-party providers use cookies and similar technologies on our website to analyse your use of our site for market research or advertising purposes ("analytics and marketing") and to provide you with additional functions (“functional”). This may result in the creation of pseudonymous usage profiles and the transfer of personal data to third countries, including the USA, which may have no adequate level of protection for the processing of personal data.

By clicking “Accept all”, you consent to the storage of cookies and the processing of personal data for these purposes, including any transfers to third countries. By clicking on “Decline all”, you do not give your consent and we will only store cookies that are necessary for our website. You can customize the cookies we store on your device or change your selection at any time - thus also revoking your consent with effect for the future - under “Manage Cookies”, or “Cookie Settings” at the bottom of the page. You can find further information in our Privacy Policy.
Accept all
Decline all
Manage cookies
✕

Privacy Preference Center

With your consent, we and third-party providers use cookies and similar technologies on our website to analyse your use of our site for market research or advertising purposes ("analytics and marketing") and to provide you with additional functions (“functional”). This may result in the creation of pseudonymous usage profiles and the transfer of personal data to third countries, including the USA, which may have no adequate level of protection for the processing of personal data. Please choose for which purposes you wish to give us your consent and store your preferences by clicking on “Accept selected”. You can find further information in our Privacy Policy.

Accept all cookies

Manage consent preferences

Essential cookies are strictly necessary to provide an online service such as our website or a service on our website which you have requested. The website or service will not work without them.

Performance cookies allow us to collect information such as number of visits and sources of traffic. This information is used in aggregate form to help us understand how our websites are being used, allowing us to improve both our website’s performance and your experience.

Google Analytics

Google Ads

Bing Ads

Facebook

LinkedIn

Quora

Hotjar

Reddit

Functional cookies collect information about your preferences and choices and make using the website a lot easier and more relevant. Without these cookies, some of the site functionality may not work as intended.

HubSpot

Social media cookies are cookies used to share user behaviour information with a third-party social media platform. They may consequently effect how social media sites present you with information in the future.

Accept selected