MongoDB – Changing the data directory name changes the data


I am witnessing a very bizarre behavior of MongoDB.

I start MongoD on a test system (Windows 10, 64bit) as follows:

"C:  Program Files  MongoDB  Server  3.6  bin  mongod.exe" --dbpath "C:  MongoData"

Then I shut down the server and replaced the MongoData directory with a production server record. I start again with the Mongod, but I get a collection 4 documentsWhat I had before In front I have replaced my test data set with a real one.

This is not correct, because I would assume that there are many documents in a real record. I then try dozens of things, including pointing MongoD to the data folder in its original location, which gives me all the documents from the real collection. Phew, the data is safe. But what happens in my test system?

I've noticed that when I rename the folder in my test system in MongoData2 and lanuch mongod to this folder, I get my correct production record. But if I rename it MongoData again and Mongod points to this folder, I get 4 documents again.

What causes this?