About MongoDB dbPath in Manual

The files in the dbPath directory must correspond to the configured storage engine. Mongod will not start if dbPath contains data files created by a storage engine other than the one specified by --storageEngine.

What’s mean this sentences…

Hello @Kim_Hakseon,

By default, MongoDB’s storage engine is WiredTiger. But, MongoDB server can be configured with other storage engines. The way the files are created and stored is different for different storage engines. In the MongoDB server versions prior to v4.2, there was an option to use MMAPv1 storage engine (see Storage Engines v4.0).

The mongod can be started by specifying the –storageEngine option. In case you have started the server using a specific storage engine, and then try to restart with another storage engine, the server will not start - when the dbpath points to the same directory as before (the --dbpath option is used to specify the directory where the database files are stored - your collections, indexes, definitions, data, etc.).

NOTE: Starting in version 4.2, MongoDB removed the deprecated MMAPv1 storage engine.

2 Likes

Ah-ha!

So, the meaning of that sentence is, “You have to use the storage engine that you first used.”, is that ?

Yes. What is the version of MongoDB you are working with?

I am 4.2 version.

And 4.4 version studying.

Generally, using a configuration file to start the mongod is a good practice - so that you don’t have to type the options on the command-line each time when starting the server. While typing the options there can be a typo or can miss an option - there can be many options for a fully configured production system.

Thank you, Thank you~

It really helped me a lot of help.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.