Mike Robbins

Sitecore Developer Blog

Follow me on GitHub

Install MongoDB as a Windows service for Sitecore

To install MongoDB as a Windows service.

  1. Download and install MongoDB https://www.mongodb.org/downloads
  2. Run Command Prompt as Admin. CD to the directory containing the bin directory of your MongoDB installation. Usually "C:\Program Files\MongoDB 2.6 Standard\bin" on a standard installation of MongoDB.
  3. Run the following script to install MongDB as a service.
    mongod --dbpath "PathToStoreMongoDbs" --serviceName "NameYouWantToCallTheService" --logpath "PathOfWhereToStoreLogFiles" --logappend --install


    mongod --dbpath "C:\inetpub\wwwroot\MikeRobbins8\Databases" --serviceName "MikeRobbinsMongoDB" --logpath "C:\inetpub\wwwroot\MikeRobbins8\MongoDBLogs\mongodb.log" --logappend --install
  4. Within the services snap in you will see the MongoDB service listed where you can start and stop the service. The service will be installed with the name you specified, however the display name will be set to MongoDB.

    MongoDB Service

    MongoDB Service

  5. You can uninstall the MongoDB service using the following command.
    mongod --serviceName "MikeRobbinsMongoDB" --remove