18
votes
Accepted
node is not in primary or recovering state
You've configured this node as a replica set member:
replication:
replSetName: "rs0"
On startup a new MongoDB server does not have a replica set configuration yet. The server will be in an
...
5
votes
Failed to import a mongodb database with duplicate fields
I have successfully upgraded a database from 2.4 to 4.0 using the following 3 step method:
use 2.4 mongobackup on the 2.4 database
delete all .json files from the outputted dump directory
use 4.0 ...
4
votes
Accepted
How to read MongoDB .mdmp files
You might want to consider opening an issue on MongoDB's Issue Tracker and providing the *.mdmp file in the issue.
*.mdmp files are considered to be Microsoft Dump Files.
Compressed file created ...
3
votes
Accepted
mongodb: update string field to integer
The solution is to use NumberInt instead of parseInt.
var coll = db.getCollection('info');
var bulk = coll.initializeOrderedBulkOp();
var counter = 0;
coll.find({ width_px: { $type: "string" }})....
3
votes
Accepted
MongoDB Primary Member of Replica Set High Memory Usage
Introduction
The oplog has nothing very little to do with memory consumption. It is a capped collection used as sort of a write-ahead log for operations to be replicated to other replica set members.
...
3
votes
Problem with Mongodb 3.6 version
First you download the Current Stable Release (3.6.0) from
Windows Server 2008 R2 64-bit and later, with SSL support x64 with (msi) file
Once you shall open the https://www.mongodb.com/download-...
3
votes
Accepted
Mongodb create user with only read and write access
I look like that you haven't enabled authentication (--auth) at the database. Without authentication, there is no authorization. That's why all users can do now whatever they want.
3
votes
Accepted
How to find all invalid document based on jsonSchema validator?
You can use the $jsonSchema query operator to find relevant documents.
For example, using the mongo shell:
// Retrieve the current validator for the "students" collection
var schema = db....
3
votes
How do we reference to a collection in MongoDB?
I wanted to know, how can I add a reference to another collection?
Relationships in MongoDB represent how various documents are logically related to each other. Relationships can be modeled via ...
3
votes
I am trying to achieve a Disaster recovery for Mongo DB
I've discovered MongoShake (https://github.com/alibaba/MongoShake) which is an open source Golang application which does cluster to cluster replication and has been made by Alibaba.
The documentation ...
3
votes
Accepted
Cannot restart or repair mongodb database after the crash (***aborting after invariant() failure)
After an unexpected crash, I can't restart ... the mongodb database
Time to exercise your Recovery Strategy, put your Recovery Plan into operation and get your database back from the Backups you've ...
3
votes
Shell Script to kill slow running Mongo Queries
Just putting this here since I was struggling with the same for a while:
Here is how you can do it in python3
Tested on mongo version 4.0 and pymongo version 3.11.4
import pymongo
client = pymongo....
2
votes
Failed to import a mongodb database with duplicate fields
As you said you are trying to import a MongoDB database, And you are using the MongoDB command such as mongorestore. And also as you said you have taken mongodump backup of MongoDB database , which ...
2
votes
Accepted
Why does mongodb fail my json schema validation?
As I am able to see you are getting the insert writeError with Error code : 121 like that
"nInserted" : 0,
"writeError" : {
"code" : 121,
"errmsg" : "Document failed validation"
...
2
votes
Accepted
Binding specific ips with Mongodb
I am running the below command:
sudo mongod --storageEngine wiredTiger --dbpath /data --bind_ip_all
--logpath /var/log/mongodb/mongod.log --fork
and everything will work just fine. Except,...
2
votes
Accepted
MongoDB 3.6 - Journal files are not getting cleaned up and they keep building everyday and use up a lot of disk space
This is a known issue recently discovered in the MongoDB 3.6.3 release when using WiredTiger on Windows: SERVER-33982: Unbounded growth of pre-allocated log files.
This issue will be corrected in the ...
2
votes
Mongo Zone Sharding Implementation Issue
Problem here is your replSetName: parameters.
BOTH config servers must be at same replica set, f.ex. conf and then those shards (data nodes) both should have different replica set names. f.ex. rs0 ...
2
votes
Accepted
Not authorized on admin to execute command mongoDB: Atlas M0 Free Tier cluster
Since you are using a hosted database service (MongoDB Atlas), many administrative commands are limited as they are either provided via the management interface or likely to introduce performance/...
2
votes
mongodb - what roles the user to grant access to all databases
I have created mongouser as testuser with below roles. I want to give
access for new databases for this user. what roles the user to grant
access to all databases.
db.createUser({ user: "...
2
votes
MongoDB does not allow to create unique partial index in field that contains null
Please use the below query to create the unique partial index. The reason why your query work is, there may many fields with the value like {rss_id: null}
db.getCollection('noticias').createIndex(
...
2
votes
Accepted
Converting MongoDB instance from Standalone to Replica Set and Backing Up
Is such conversion considered a safe operation?
Converting a standalone node to a replica set is a straightforward procedure, but if you do not have a backup of your deployment (and this data is ...
2
votes
Accepted
Restoring from MongoDB Atlas (4.2.5) to DocumentDB (3.6) do no succeed due to error "Unsupported BSON : type Decimal128"
According to the following comparison chart, MongoDB Atlas and Amazon DocumentDB are not fully compatible:
+====================================+=======================================================...
Community wiki
2
votes
Migrate data from an older version of mongodb
When upgrading any software it's usually a good idea to check the manual first, and read something like this:
To upgrade an existing MongoDB deployment to 3.6, you must be running
a 3.4-series ...
1
vote
Mongo doesn't restore user password
So I found solution, --drop shoud be added in the command:
mongodump -h $HOST:$PORT --ssl --sslAllowInvalidCertificates --authenticationDatabase $authdb -u $user -p $pass --drop --gzip --archive=$...
1
vote
It is possible to take incremental backup in mongoDB Shard cluster? without opsmanager
Consider using Percona tool if you are using MongoDB version above 3.6. Taking dump of individual shards and trying to stitch it together while restoring is not advisable.
1
vote
Accepted
How to avoid warning with file system cache in mongodb?
Any ideas how to avoid warning?
This warning was added for some older implementations of MongoDB's WiredTiger storage engine, but is longer relevant in MongoDB 3.6. The warning has been removed in ...
1
vote
Mongodump Backup Resume
If you're using the WiredTiger storage engine, data in the database is compressed (using snappy by default). In contrast, mongodump output is not compressed. This is why 2TB may not be enough to ...
1
vote
High CPU Utilization for Mongodb ReplicaSet Secondary Nodes
As per MongoDB blog documentation from Asya Kamsky here CPU load is almost
never the bottleneck/limiting resource for MongoDB (or databases in
general).
Unless you are running a large number of ...
1
vote
How to configure SSL mongodb connection in yml file spring boot?
You can try a configuration like the one below;
server:
ssl:
key-store: classpath:keystore.jks
key-store-password: secret
key-password: another-secret
data:
mongodb:
...
1
vote
Allow only find and insert action to mongodb collection
I created role with your db.createRole(..., I didn't "need" to use your grantPrivilegesToRole command. Then I created user
db.createUser({"user":"test2",pwd:"password",roles:["master"]})
and ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
mongodb-3.6 × 94mongodb × 81
sharding × 11
replication × 8
mongodb-3.4 × 8
performance × 3
database-design × 3
backup × 3
scripting × 3
python × 3
mongodb-3.0 × 3
mongodb-3.2 × 3
mongodb2.4 × 3
restore × 2
migration × 2
memory × 2
aggregate × 2
ubuntu × 2
upgrade × 2
aws × 2
powershell × 2
docker × 2
cache × 2
mongodb-4.0 × 2
wiredtiger × 2