Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7863043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:21:05+00:00 2026-06-02T23:21:05+00:00

The readonly users have only read permissions. Thus, a user having readonly true is

  • 0

The readonly users have only read permissions. Thus, a user having readonly true is not authorized to add new user or any write capabilities.

I am building a utility which manages the data in MongoDB. When i log in as readonly user it should not allow me to add new user. When I implement it, it does not actually add a user but it is not throwing any exception.

Here is my commands for adding a readonly user

var credentials = new MongoCredentials(username, password,false);
var addUser = new MongoUser(credentials, readOnly);
var database = server.GetDatabase(databaseName);
database.AddUser(addUser);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T23:21:07+00:00Added an answer on June 2, 2026 at 11:21 pm

    Did you start mongod with the –auth command line argument?

    Did you use safe=true on your connection string?

    Also, you need to use admin credentials to add a user to a database:

    var adminCredentials = new MongoCredentials("adminuser", "adminpassword", true);
    var userCredentials = new MongoCredentials("username", "password");
    var user = new MongoUser(userCredentials, true);
    var fooDatabase = server.GetDatabase("foo", adminCredentials);
    fooDatabase.AddUser(user);
    

    Notice that there are two sets of credentials: one for the user being added, and another set of admin credentials for your code to be able to add the user.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a read only combo-box with 5 values in, when the user selects
Some users will use the database as read-only and some will need to add,
I want a group of users to have read-only access to all tables and
I have a request from users to modify Microsoft CRM to make it's read-only
Having trouble with a mysql grant statement. I want a user who has: readonly
Is there a way to make the UIPickerView read-only? This means that the user
For my application I want to have users with different permissions. One permission would
I have a read only DGV on a tab of my application. I let
I have a DataGridView that has three read only columns in it and one
I have a DataGridView in C# (.NET 2.0) with a few read-only cells (3

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.