0

[Windows 10] When I was upgrading Mongo community(3.6 - 4.2), I had to clear data/db/ folder. So i lost all databases. Is there any way to prevent data loses? I know i can take backup using Studio 3T (Exporting and importing). But i dont want to do that because exporting and importing all dbs will really be a cumbersome. Suggest me something from which i can migrate 3.6 - 4.2. without clearing db folder. I have tried migrating to 4.2 on a different PC, now i want to do that with my system too.

Also tried this - db.adminCommand( { setFeatureCompatibilityVersion: "4.2" } ).

  • Are you using `MMAPv1` as your storage engine(*as it is deprecated from v4.2*) if not then it won't be a problem? But if you are using i suggest taking a look at [Change Standalone to WiredTiget](https://docs.mongodb.com/manual/tutorial/change-standalone-wiredtiger/). Also instead of Exporting and Importing, i think you should use the [MongoDump](https://docs.mongodb.com/manual/reference/program/mongodump/#bin.mongodump) and [MongoRestore](https://docs.mongodb.com/manual/reference/program/mongorestore/#bin.mongorestore). – vikscool Feb 20 '20 at 05:00
  • I am using WiredTiger storage engine. – Kiran L Patil Feb 20 '20 at 05:12
  • As its windows, we don't have the functionality(*at least with MongoDB's executable*) to just upgrade it. So, when you are going to install the latest version of mongo it is going to create a separate folder for the new version in your installation directory. Which would display 2 folders of `3.6` and `4.2` . And the `mongodump` and `restore` parts are here only for `safekeeping` (*if things don't work out that way you have planned and you don't have to clear the data folder*). – vikscool Feb 20 '20 at 05:30
  • mongod version 4.2 can't read the data files from mongod 3.6, you would have to upgrade to 4.0, run it at least long enough to set the feature compatibility to 4.0, and then upgrade to 4.2 – Joe Feb 22 '20 at 09:01

0 Answers0