MongoDB provides features that allow administrators to implement controls to ensure that users and applications have access to only the data that they require controls and restrictions for any MongoDB deployment.
Questions tagged [mongodb-security]
15 questions
4
votes
1 answer
How to create user with read-write access for specific DB only in MongoDB?
I've created user by shell:
use testDB
db.createUser({user: 'testUser', pwd: 'password', roles: ["readWrite"]})
But the user can see and modify another databases also (like admin).
I've checked by db.runCommand({connectionStatus : 1}) and…

grzesiu988
- 184
- 3
- 14
1
vote
1 answer
MongoDB URI Connection String Using TLS?
I'm trying to connect to a local MongoDB using only a URI string over TLS. I can connect just fine using flags, but for my project's purposes I'd like to have a URI string too.
For example, the following works:
mongo mongodb://127.0.0.1:27017/dbName…

automated-tester
- 11
- 2
1
vote
0 answers
How to perform specific actions for all collections in DB except for a specific collection using roles in MongoDB?
I want to be able to read, insert, update, find and delete for the to-dos collection and for the users collection, I just want to find, insert and update. My first solution was:
db.createRole(
{
role: "all_permissions_except_user_delete",
…

Carlos Herrera
- 325
- 1
- 6
0
votes
0 answers
How to find Mongodb Authentication Restrictions options values
What is the clientSource and serverAddress to be used. How to find the value of it to be used?
How the values can be tried in localhost ?

user2527732
- 11
- 2
0
votes
0 answers
Securely Streaming Videos in Flutter with MongoDB based on authorization
I am working on a video streaming platform where I only want to allow premium users to access certain videos. I can store videos in CDN and save their URLs in MongoDB but that would give access to the video to everyone having that link. Is there any…

Chetan Goyal
- 435
- 5
- 14
0
votes
1 answer
In MongoDB, can I add a regular user that can read any non-admin DB?
I have MongoDB set up on my laptop for a MEAN Stack university class I'm taking this semester, but of course I don't know what databases I'll be creating for the class, nor how many.
I found this SO question about adding users to MongoDB, and I have…

Andrew
- 55
- 8
0
votes
1 answer
Mongodb Server Whitelist
Performed the following steps as per the Mongodb Document : https://docs.mongodb.com/manual/security/
1. User authentication
2. TLS/SSL implementation
My question is can we implement IPWhiteList for Mongodb Server?
If not, then is there any other…

Sushant
- 5
- 2
0
votes
0 answers
MongoDB - How to Change current logged in user's password?
I am logging in to the test database using the following credentials
username : testUser
password : pass
The user has only readWrite access to the database. I want to change the current user's password to pass123.
I tried both the below…

Mani
- 1,471
- 1
- 13
- 19
0
votes
0 answers
Mongo DB: How to enable authentication only on single database
Assume, I have 3 databases AX,BX,CX
I want to enable authentication only on the DB CX.
My understanding is, we can enable authentication only on port (example-27017).
Can you pleas help me in setting up authentication only on CX DB

Rakesh Baddam
- 1
- 1
0
votes
1 answer
MongoDB Write Issue: Different DBs showing different count for same documents
I am trying to BulkInsert certain documents in different collections in 2 Databases in MongoDB.
MongoClient mongoClient2 = this.getMongoClient();
MongoDatabase currentDB = mongoClient2.getDatabase(splits[0]);
MongoCollection…

Niks
- 41
- 2
- 8
0
votes
1 answer
Minimal roles/privileges for a mongoDb user in order to be able to create new databases
I am writing a program that operates on one main mongoDb but may create new mongo databases.
I am trying to figure out what are the minimal rights that the mongoDbUser (used by my program) needs in order to be able to create new databases and have…

raduw
- 1,008
- 1
- 9
- 19
0
votes
1 answer
How to authenticate against a mongod instance in sharded cluster after security has been enabled?
I am working with a mongo cluster with 3 shards. Each shard replica-set in turn has 3 members. Security is enabled and I created users with clusteradmin, useradmin etc. roles, also many users whose access confined to particular databases.
But now I…

Nipun Talukdar
- 4,975
- 6
- 30
- 42
0
votes
0 answers
MongoDB -- recent hacks. Seeking real-world solutions
as you know there have been many attacks recently and tens of thousands of MongoDB databases were hacked and the data is held for ransom. Even mainstream news sources like BBC covered this.
Many sources claim that only Mongo versions below 2.6 are…

372
- 237
- 2
- 10
0
votes
1 answer
Is this a bug in MongoDB Shell
I have two users, a user with root role and another user with read only role on the database. When I login as root then switch to read only user without exiting the shell, MongoDB allows me to run and execute root level commands even though I am…

fanbondi
- 1,035
- 5
- 18
- 37
0
votes
1 answer
Create a user, but then can't connect with it
I've created a new user on a clean database, but can't connect with it. I can, however, connect with no credentials.
PS C:\Program Files\MongoDB\Server\3.0\bin> .\mongo.exe localhost/test
MongoDB shell version: 3.0.11
connecting to:…

BanksySan
- 27,362
- 33
- 117
- 216