Search code examples
mongodbmongorestore

Mongorestore writing to MongoDB datafiles


MongoDB documentation has the following line. What do they mean when they say, mongorestore can directly write to MongoDB data files without an active mongod? Does it mean it can write even if a mongod instance is not ready and reachable, or, is there something called inactive mongod instance. I am finding it difficult to understand. Can someone explain me this?

mongorestore can write data to either mongod or mongos instances, in addition to writing directly to MongoDB data files without an active mongod.


Solution

  • Prior to v3.x mongorestore could be configured to write directly to data files rather than writing into data files via mongod.

    The term "data files" here refers to the contents of a dbpath directory so, by specifying --dbpath you could tell mongorestore to attach to the data files in that directory and insert data into those files without having to go through a mongod instance.