How to upgrade MongoDB on Windows Server How to upgrade MongoDB on Windows Server mongodb mongodb

How to upgrade MongoDB on Windows Server


Edit:First start the cmd.exe in admin mode and cd to the location of the old installation, for standard installations:

cd C:\Program Files\MongoDB\Server\3.2\bin

Stop all applications, which are accessing mongodb, then enter

mongod --remove

Then install the new mongo db, copy the mongod.cfg file from 3.2 to 3.4 directory. When you had one, otherwise follow the installation instructions for setting up the new service. This update worked fine for me, all data available, I didn't need to use this features switched off.


I upgraded from version 3.6.0 to 3.6.2 just today and below are the steps involved:

  1. Download the latest version from the [mongodb wesbite][1].
  2. When downloading is complete, stop any running instance of mongodb by typing 'Ctrl+C' on the command console.
  3. Run the installation file and it automatically installs the new version at the same path as the previous version (at C:\ProgramFiles\MongoDB\Server\3.6).
  4. Start the database server by typing 'mongod'.
  5. All previous databases will be accessible to you.


Windows MongoDB major version upgrade can be performed easily in-place , here i am describing the steps to upgrade MongoDB 4.2 to 4.4 with existing data directory. You can follow the same for any version upgrade.

We will use the Windows command prompt to perform all steps below:

  1. For safety take a backup of existing DB, provide a path to backup them

cd C:\Program Files\MongoDB\Server\4.2\bin

mongodump -o D:\DB_backup

  1. Stop all the application writes and shutdown the MongoDB service

type "services. msc" and hit Enter or press OK

Services -> MongoDB Server -> Right click & stop

  1. Install the new MongoDB mongodb-windows-x86_64-enterprise-4.4.8-signed.msi file msi package by using GUI provide the old exixting directories. Meanwhile rename directory from 4.2 to 4.4

Data dir - D:\MongoDB\Server\4.4\data

Log dir  - D:\MongoDB\Server\4.4\log\

This will replace all the bin files with older version ones and MongoDB will be started automatically.

  1. Finally , move to the bin directory, run mongo.exe client and check the DB availablity

cd C:\Program Files\MongoDB\Server\4.4\bin