-1

I use Windows 7 32 bits. I can run MongoDB with this command

"C:\Program Files\MongoDB\Server\3.2\bin\mongod.exe" --storageEngine=mmapv1 --dbpath="C:\data\db". 

But after shutdown (I mean when I restart my PC after a shutdown), I can't use it again. I have to delete all files and folders in db directory (which are previously created because I ran MongoDB with that command). Then it works. I mean I can run MongoDB again with that command only after deleting all files and folders inside db directory (C / data / db ). But this way I lose all my previous database contents (the things I saved in my database).

How can I rerun MongoDB when I am working again after a shutdown without having to delete all the files and folders?

IMAGES HERE:

Not Working: https://www.dropbox.com/s/np86dmbrcmdh93l/Screenshot%202020-05-26%2007.41.58.png?dl=0

Deleted all files in db: https://www.dropbox.com/s/1n8vyz13v0c7ods/Screenshot%202020-05-26%2007.47.23.png?dl=0

Works now but lost all prev files: https://www.dropbox.com/s/1jgymmjntv5p6nk/Screenshot%202020-05-26%2007.46.49.png?dl=0

  • Did you visit and try the solution from [the link](https://docs.mongodb.com/manual/tutorial/recover-data-following-unexpected-shutdown/) in the first image? – theusaf May 26 '20 at 03:01
  • Please don't paste images, use formatted text for code and error message. – Wernfried Domscheit May 26 '20 at 07:47
  • Maybe check https://stackoverflow.com/questions/30501440/mongodb-hotfix-kb2731284 - and consider an upgrade. Almost everything (Windows 7, MMAPv1 Storage Engine) you use is outdated and not supported anymore. – Wernfried Domscheit May 26 '20 at 07:53
  • According [MMAPv1 Storage Engine](https://docs.mongodb.com/v4.0/core/mmapv1/) you can use it only on 64-bit systems, 32-bit is not supported. – Wernfried Domscheit May 26 '20 at 07:54

1 Answers1

0

Every time you run the command it creates a "mongod.lock" file in your db directory. So when you re-run after a shutdown, just delete this "mongod.lock" file only. You will not have to delete all the db files. So you will not lose any database contents (things that you saved in the database).