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. ...

Get MongoDB Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.