Hi Champs,

I have taken the opportunity and writing this blog to help you guys to create MongoDB as a windows Service to work with Sitecore.

If you are doing development work with Sitecore 7.5+ and beyond, you may want to set up MongoDB to connect to Sitecore locally or on your DEV, QA, STAGING servers. This is just a brief tutorial on the steps needed to set up MongoDB on your as a service, and then validate that it is connected to your local Sitecore instance via RoboMongo. This post relates to Sitecore versions 7.5 and up.

  1. Download the MongoDB installer here: MongoDB
  2. Install using the Custom installation so you can change the default location. Typically, I put all my projects and websites on a separate non-operating system drive such as a D: drive. I installed to D:/MongoDB/.
  3. In the folder “MongoDB” create a folder called “data” and inside that folder, create a folder called “db”. These will not be created for you during install so you will need to create them.
  4. Create a new .config file in the “MongoDB” folder and name it “mongo.config”. This is where we will store the configurations for MongoDB.
  5. Copy/paste the configuration into the new “mongo.config” file and modify to your specific workstation:

dbpath=D:\MongoDB\data\db

logpath=D:\MongoDB\log\mongo.log

smallfiles=true

  1. Next, look in the “MongoDB” folder. You may need to create the “log” folder and put a “mongo.log” file in the that folder for the next line to succeed if it was not created during the installation of MongoDB.Now, install MongoDB as a Windows Service, so it will start every time you start-up Windows and stay running. Open up a Command Prompt (Run As Administrator) and type in the following (modify if needed for your filepaths):

D:\MongoDB\bin\Mongod.exe –config D:\MongoDB\mongo.config –install

  1. This will create a new windows service called MongoDB. Now, to start the service simply type in the following:

net start MongoDB

  1. You can use GUI tools like Robo 3T(RoboMongo) to work with Mongo data. Typically, Sitecore connections strings are already setup OOTB so you really just need to set up MongoDB. If you want to verify that your data is being stored then simply download Robo 3T(RoboMongo). The example below is using MongoVUE, but I don’t recommend as it has been problematic in the past to download from their website. However, the process is basically the same for Robo 3T(RoboMongo).
  2. Once installed you simply click the green plus icon to add a connection, then type in the name of the connection, and the server. Since, you this is on your local workstation you will use localhost OR 127.0.0.1 then save.
  3. Once connected you will get all the xDB databases in Robo 3T(RoboMongo). you can edit,check and analyze you queries by the help of NoSQL queries for MongoDB.

 

Thanks for reading !!