4

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 unknown replica set member state until you either add this member to an existing replica set configuration or use rs.initiate() to establish it as the first member ...


4

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 mongorestore on the remaining .bson files


4

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 by Windows after a program error or crash; contains data "dumped" from the program's memory space; saves information about the error, which can be used for ...


3

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.getCollectionInfos({ name: "students" })[0].options.validator // Find any documents not matching the schema db.students.find({ $nor: [schema] }) ...


3

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

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-center#community , directly it will open to first tab . which is in MongoDB download center, But you have to click on the Community Server and download (.msi) files....


3

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 taken of it. Your database is actually remarkably resilient. Left to its own devices (and all other things being equal) it will recover from a server crash all ...


2

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 Embedded and Referenced approaches. Such relationships can be either 1:1, 1:N, N:1 or N:N. It's possible through Modeling Referenced Relationships and DBRefs. Here ...


2

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 MongoDB version is 2.4 & you are going to import that mongodump backup in MongoDB , which version is 3.6. As I would like to say here as per MongoDB BOL ...


2

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, binding all is not secure enough. As per MongoDB BOL here there is Warning: Before you bind to other ip addresses, consider enabling access control and ...


2

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 3.6.4 production release, so upgrading to MongoDB 3.6.4 (or newer) when available should resolve the issue. In the interim, possible workarounds are: Disable ...


2

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 and rs1. Now your config1 is rs0 and config2 is rs1.


2

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: "testuser" , pwd: "testuser", roles: ["dbAdminAnyDatabase", "readWriteAnyDatabase", "enableSharding"]}); As per MongoDB documentation here MongoDB grants access ...


2

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/stability issues. The Atlas free tier has additional limitations since it is backed by a shared MongoDB instance. See: Unsupported Commands in M0/M2/M5 Clusters. ...


2

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. In general, MongoDB uses up to around 85% (give and take) of memory unless told otherwise. This memory is used to keep the indices and the "working set" (...


2

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 release. To upgrade from a version earlier than the 3.4-series, you must successively upgrade major releases until you have upgraded to 3.4-series. For example, if ...


1

We know that the Replica Set does not work by itself with two machines, but we have this limitation. If your goal is high availability with automated failover I would definitely aim for a solution that does not involve reconfiguring the replica set or allow for the possibility of multiple active primaries. Ideally this does require a third machine so you ...


1

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=$destination


1

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" }}).forEach(function(data) { var updoc = { "$set": {} }; updoc["$set"]["width_px"] = NumberInt(data.width_px); // queue the update bulk.find(...


1

As per MongoDB documentation here From the Documents tab in MongoDB Compass, you can view, insert, clone, modify, and delete documents . First you have to connect your mongod with MongoDB Compass then you shall able to change your desire data type of their respective field in MongoDB. Change Field Type You can change the data type of a field by using the ...


1

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 backup a 1.5TB database. To determine the uncompressed size of your database, you can run db.stats().dataSize in the mongo shell (see manual). To determine the ...


1

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 MapReduce jobs and/or aggregation framework queries, high CPU utilization tends to indicate that you have poorly tuned queries possibly with in-memory sorts (as ...


1

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: authentication-database: admin database: <database> host: <host> password: <password> port: <port&...


1

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 changes to it with db.auth("test2","password") If I change to database test, command db.lock.insert({}) fails, as it should be, but if I change database to ...


1

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" As per MongoDB blog documentation of @Jai Hirsch here for MongoDB document validation. Sometimes you want completely free form documents and sometimes you don’...


1

Problem is in metadata.json files. You need to remove 'options' and it will work just fine. I even created small python tool to do this: from glob import glob import json for filename in sorted(glob('dump/*/*.metadata.json')): with open(filename, 'r') as f: data = json.loads(f.read()) if 'options' in data: del data['options'] ...


1

I found a free tool that will set SetSystemFileCacheSize here with 16 gigs of RAM I set it to 1024 4096 and the mongod warning went away


1

The --fork is a flag to tell mongod to run as a background process, rather than as an active process which blocks the shell. Mongod is the main daemon process for MongoDB. It's the core unit of the database, handling connections, requests, and the most important part of it, persisting of data, or writing your data at a disk. A daemon is a program or a ...


1

You just kill the process. killall mongod To check that you don't have any mongod process running anymore, you can use ps -ef|grep mongod|grep -v grep or just pgrep mongod. With that latter, if you get pid number (as answer), mongod is still running


1

Yes, it is normal behavior. Those connections are from other mongod nodes, because every node "watches" every other node to see who is reachable. This because election must be started even in the situation where secondary node disappear from replica set.


Only top voted, non community-wiki answers of a minimum length are eligible