The Stack Overflow podcast is back! Listen to an interview with our new CEO.
3

Ref: https://docs.mongodb.com/manual/reference/method/db.collection.stats/ https://docs.mongodb.com/manual/reference/command/collStats/#collStats.indexDetails As you are using WiredTiger storage engine you can use db.collection.stats() with indexDetails option set to true. Easy copy paste: .stats({"indexDetails":true}) A document that reports data ...


3

sudo service mongo stop [This didn't work] As MongoDB BOL mongo is an interactive JavaScript shell interface to MongoDB, which provides a powerful interface for systems administrators as well as a way for developers to test queries and operations directly with the database. mongo also provides a fully functional JavaScript environment for use with a ...


3

Since you are using the MMAP storage engine there are several factors to be aware of: The compact command only defragments data files & indexes in MMAP; it does not release unused space to the operating system. Running compact can still be useful to reduce fragmentation and encourage free space reuse, but will not help if your disk space is critically ...


3

That error implies there is already data in TestDataBase.testCollections. You might consider using the --drop option: Before restoring the collections from the dumped backup, drops the collections from the target database. --drop does not drop collections that are not in the backup. When the restore includes the admin database, mongorestore with --...


3

Reasons for unexpected data growth of data files. "Data fragmentation" and data file preallocation When a document is deleted, it's space is used right away if the new document fits into that space. Let's say you delete a document which takes 1kb of disk space and a new document requiring 0.9 Kb of disk space is synced to disk, then the first free space (...


2

The best approach is to use a 3 member replica set. Periodically you will stop one of the secondaries, wipe the data directory and start it. The secondary will begin an initial sync which will remove all fragmentation since it will re-write all datafiles from scratch. Then do the same for the other secondary and perform a stepdown. The stepdown will ...


2

The solution to this issue was as follows: Starting with the secondary: Inside of Mongo I ran the following: db.shutdownServer() exit On the command line: rm -rf /var/lib/mongodb/* sudo service mongodb start It then takes a couple of hours to resync. Once resynced I did the following on the primary: rs.status() //To make sure that the everything was ...


2

If your data exist on a node then this node is named Primary from now on and the other 2 secondaries. 1) Start the Primary as standalone and drop the index. 2) Take a backup of your data just in case 3) Stop secondaries and delete their data directory. 4) Start the Primary as a member of the replica set. 5) Start the first secondary. This will cause an ...


2

There are two operations here 1. Compact - This is an in place compact of data inside the data files. This will however not release any of the data files. Even thought it does not return the free space to the file system mongo should be able to use the space for growth. 2. Repair - This will release any unused space back to the filesystem. This is what you ...


2

This question is for Linux, but for fellow windows users who found their way here and want a windows solution... the problem is your Mongodb service is stopped. So do the following steps: 1) cntrl-alt-del and open your task manager 2) click on 'services' 3) scroll down to MongoDB 4) right click and hit 'start' (or 'restart') go back to ...


2

I also ran into same issue. But was able to resolve by completely removing mongo first sudo apt-get purge mongodb-org* Then performing following sudo apt update sudo apt install -y mongodb sudo systemctl status mongodb You can refer to following link for the same: https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-18-04


2

As your service mongodb status tells, your mongod process don't exists. So, if you try to connect (with mongo -program) to your mongod, you cannot. So, restart your mongod sudo service mongodb restart, try now to connect it mongo. If you want to see what happens when you shutdown, start following mongodb.log tail -f /var/log/mongodb/mongodb.log and then ...


2

It looks like your namespace file is still corrupt, you get similar errors when you hit the max number of collections for a database in MMAPv1. To try to fix this up and get a database that is in a more consistent state you can try recreating your collections in a new database. If you have auth enabled, you will need to do this in the admin database - note ...


1

If the problem is related to a remote access, here is the solution for anyone who has the problem show iptable rules line numbers sudo iptables -L --line-numbers The output will be something like this ... num target prot opt source destination 1 ACCEPT all -- anywhere anywhere ctstate RELATED,...


1

OK.. You have managed to get your self in middle of mess. As it says: UnsupportedFormat: Unable to find metadata for table:index-3--243586308771972589 Index: {name: id, ns: admin.system.version} - version too new for this mongod. See http://dochub.mongodb.org/core/3.4-index-downgrade for detailed instructions on how to handle this error Index ...


1

Once and for all: The database repair command is potentially harmful and is advised against You should not use repairDatabase for data recovery unless you have no other option. And This command obtains a global write lock and will block other operations until it has completed. Hardly what you want in a production system. I already answered a similar, ...


1

Your question is very broad as there are multiple storage engines in MongoDB 3.0+ (and a storage engine API). Physical layout for data and indexes will depend on the storage engine implementation, but it sounds like your general question is how documents with varying schemas are stored and indexed. Conceptually each document is stored in a contiguous binary ...


1

ReplSet configuration exists on many other members of that replica set. You can safely drop the local db collections (you can even drop the whole DB but then you will just end up syncing from another replica and there is no point to repairing this entire DB). So drop the troublesome collection - it will be recreated when the host rejoins its replica set. ...


1

In my opinion if your fragmentation is not over 15-20% its not worth doing that (except if you are running out of disk space). What i would do is: 1) Add an arbiter to each replica set (optional) 2) Shutdown one of the secondaries and delete the data directory 3) Start the secondary and let it do the initial sync which removes fragmentation (at this ...


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