What does it mean to install MongoDb as a service?

When installing MongoDb, I get the option to install it as a service. What does that mean? If I don't select that option, what difference would it make? Also, selecting "install as a service" will bring up additional options, such as "Run service as a network service user" or "run service as a local or domain user". What do these options do?


Solution 1:

I'm speaking in the perspective of Windows development, but the concepts are similar with other Operating Systems, such as Linux.

What are services?

Services are application types that run in the system's background. These are applications such as task schedulers and event loggers. If you look at the Task Manager > Processes, you can see that you have a series of Service Hosts which are containers hosting your Windows Services.

What difference does setting MongoDB as a service make?

Running MongoDB as a service gives you some flexibility with how you can run and deploy MongoDB. For example, you can have MongoDB run at startup and restart on failures. If you don't set MongoDB up as a service, you will have to run the MongoDB server every time.

So, what is the difference between a network service and a local service?

Running MongoDB as a network service means that your service will have permission to access the network with the same credentials as the computer you are using. Running MongoDB locally will run the service without network connectivity.(Refer Source here)