Setting up MongoDB as a windows service
Windows services are long-running applications that run in background, similar to daemon threads. Databases are good candidates for such type of services, whereby they would start and stop when the host machines starts and stops (you may, however, choose to manually start/stop a service). Many database vendors provide a feature to start the database as a service when installed on the server. MongoDB lets you do that as well and this is what we will see in this recipe.
Getting ready
Refer to the recipe Installing single node MongoDB with options from the config file in Chapter 1, Installing and Starting the Server for getting information on how to start a MongoDB server using an external configuration file. Since mongo is run as a service in this case, it cannot be provided with command-like arguments and configuring it from configuration file is the only alternative. Refer to the prerequisites of the Installing single node MongoDB recipe in Chapter 1...