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)

Answer from Astolfo on Stack Overflow
🌐
MongoDB
mongodb.com › resources › basics › databases › database-as-a-service
Database As A Service (DBaaS) Explained | MongoDB
What is DBaaS? How does Database as a Service actually work? And why does Database as a Service matter for your applications? Learn this and more.
People also ask

What is MongoDB?
MongoDB is a non-relational (NoSQL) and document-oriented database, which uses JSON-like documents with optional Database Management System (DBMS) schemas. It is a software that stores, manipulates and manages data in a database.
🌐
ovhcloud.com
ovhcloud.com › public cloud › databases for mongodb
Managed MongoDB database as a Service | OVHcloud Worldwide
Why is MongoDB popular?
Despite its widespread popularity, you may still find yourself asking “What is MongoDB used for?” MongoDB can store and manage any type of data, regardless of the structure. As a NoSQL database, it is very flexible, as it allows developers to control schema, which makes data modelling updates easier. It is also popular thanks to its scalability, which enables you to store large volumes of data.
🌐
ovhcloud.com
ovhcloud.com › public cloud › databases for mongodb
Managed MongoDB database as a Service | OVHcloud Worldwide
Why do I have to pay for Managed MongoDB on Public Cloud when using a service plan with the MongoDB Community licence?
We perform all the database management and administration tasks for you, so you don't have to worry about setup, maintenance, backup security and scalability, meaning you can focus on your core business activities.
🌐
ovhcloud.com
ovhcloud.com › public cloud › databases for mongodb
Managed MongoDB database as a Service | OVHcloud Worldwide
🌐
MongoDB
mongodb.com › products › platform › cloud
MongoDB Cloud | MongoDB
MongoDB Cloud is a unified data platform for modern applications that includes a global cloud database, search, data lake, and mobile and application services.
🌐
OVHcloud
ovhcloud.com › public cloud › databases for mongodb
Managed MongoDB database as a Service | OVHcloud Worldwide
Managed MongoDB is a Database as a Service (DBaaS) provided on OVHcloud Public Cloud. We offer the MongoDB DBMS in packages on one or more Public Cloud instances and provide it as a turnkey service. This means that we handle management and administration tasks, including setup, maintenance, ...
🌐
MongoDB
mongodb.com › solutions › use-cases › data-as-a-service
What Is Data As A Service (DaaS)? | Full Explanation | MongoDB | MongoDB
MongoDB EventMongoDB.local SF, Jan 15: See the speaker lineup & ship your AI vision faster. Use ... Data as a service (DaaS) is a business model where data is made available on demand and regardless of the consumer’s location or infrastructure.
🌐
GeeksforGeeks
geeksforgeeks.org › mongodb › how-to-run-mongodb-as-a-windows-service
How to run MongoDB as a Windows service? - GeeksforGeeks
July 23, 2025 - Run the following command to initiate the MongoDB service: mongod --config "C:\mongodb\bin\mongod.cfg" --install · This command installs MongoDB as a Windows service using the specified configuration file.
🌐
DigitalOcean
digitalocean.com › products › managed-databases-mongodb
Managed MongoDB Hosting Starting at $15.225/mo | DigitalOcean
... DigitalOcean’s Managed MongoDB is a fully managed, certified MongoDB service that handles provisioning, backups, updates, monitoring, and security, so developers and businesses can focus on building their apps rather than managing databases.
Find elsewhere
Top answer
1 of 16
392

After trying for several hours, I finally did it.

Make sure:

  1. you added the <MONGODB_PATH>\bin directory to the system variable PATH
  2. run command prompt as administrator

Steps:

step 1: execute this command:

D:\mongodb\bin>mongod --remove

Step 2: execute this command after opening command prompt as administrator:

D:\mongodb\bin>mongod --dbpath=D:\mongodb --logpath=D:\mongodb\log.txt --install

NOTE: you can also append --serviceName MongoDB after the command above.

That's All!


After that right there in the command prompt execute:
services.msc

// OR

net start MongoDB

And look for MongoDB service and click start.


NOTE: Make sure to run command prompt as administrator.

If you don't do this, your log file (D:\mongodb\log.txt in the above example) will contain lines like these:

2016-11-11T15:24:54.618-0800 I CONTROL  [main] Trying to install Windows service 'MongoDB'
2016-11-11T15:24:54.618-0800 I CONTROL  [main] Error connecting to the Service Control Manager: Access is denied. (5)

and if you try to start the service from a non-admin console, (i.e. net start MongoDB or Start-Service MongoDB in PowerShell), you'll get a response like this:

System error 5 has occurred.
Access is denied.

or this:

Start-Service : Service 'MongoDB (MongoDB)' cannot be started due to the following error: Cannot open MongoDB service
on computer '.'.
At line:1 char:1
+ Start-Service MongoDB
+ ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Start-Service],
   ServiceCommandException
    + FullyQualifiedErrorId : CouldNotStartService,Microsoft.PowerShell.Commands.StartServiceComman
2 of 16
122

I think if you run it with the --install command line switch, it installs it as a Windows Service.

mongod --install

It might be worth reading this thread first though. There seems to be some problems with relative/absolute paths when the relevant registry key gets written.

🌐
Google Cloud
cloud.google.com › mongodb
MongoDB Atlas | Google Cloud
MongoDB Atlas provided customers a fully managed, database-as-a-service on Google’s data cloud that is unmatched in terms of speed, scale, and security—all with AI built in.
🌐
Quora
quora.com › Should-I-install-MongoDB-as-a-service-1
Should I install MongoDB as a service? - Quora
Hopefully 64-bit. If you install it as a service, every time the machine reboots mongodb will start up. It will then sit in the background running on the machine. If you don’t install it as a service or set the servic...
🌐
C# Corner
c-sharpcorner.com › article › configure-a-windows-service-for-mongodb
Configure A Windows Service For MongoDB
August 9, 2023 - In this article, we will learn how to create and configure a Windows Service for MongoDB. In the previous article of this series, we learned How To Set Up And Start With MongoDB. During the installation of MongoDB, we didn’t check the "Install MongoDB as a service" option as I wanted to show ...
🌐
Medium
medium.com › stackfame › run-mongodb-as-a-service-in-windows-b0acd3a4b712
Run MongoDB as a Service in Windows | by VithalReddy | stackFAME | Medium
June 1, 2018 - Today we will learn How to Setup and run MongoDB windows service continuing our MongoDB Development Tutorials series. MongoDB king of NoSQL databases, check out Introduction to MEAN Stack article to know why. In this article, You will learn to Setup, config, start and run MongoDB As a Service in Windows PC to be precise Windows 10 64bit and 32 bit, Windows 7 64bit and 32 bit.
🌐
MongoDB
mongodb.com › atlas › database
MongoDB Atlas Database | Multi-Cloud Database Service | MongoDB
The most advanced cloud database ... more. ... MongoDB Atlas is an integrated suite of data services centered around a cloud database designed to accelerate and simplify how you build with data....
🌐
NetApp
netapp.com › home › blog › aws-cvo-blg-mongodb-on-aws-managed-service-vs-self-managed
MongoDB on AWS: Managed Service vs. Self-Managed | NetApp
April 25, 2025 - MongoDB Atlas offers users a managed, pay-as-you-go pricing model with the ability to deploy on any cloud service provider of their choice, AWS included. It provides an automated patching and one-click upgrade from high availability to scalability ...
🌐
Wikipedia
en.wikipedia.org › wiki › MongoDB
MongoDB - Wikipedia
3 days ago - MongoDB was originally best known as a NoSQL database product. The company released a database as-a-service product called Atlas in 2016 that became 70 percent of MongoDB's revenue by 2024.
🌐
Hevo
hevodata.com › home › learn › database management system
What Are the Top Free MongoDB Storage Services in 2025?
January 3, 2025 - Free MongoDB schema design. Additionally, they offer customers with larger workloads a private Slack channel, quarterly business reviews, and high-traffic event planning. Scalingo is a Platform as a Service (Paas) that is designed to host applications on the cloud.
🌐
Microsoft Azure
azure.microsoft.com › en-us › solutions › mongodb
MongoDB Atlas on Azure | Microsoft Azure
Easily deploy a MongoDB, Express.js, React.js, and Node.js (MERN) Stack application to Azure App Service.
Top answer
1 of 7
11

The following works fine for me

mongod --install --serviceName "Mongo DB instance" --serviceDisplayName "Mongo DB instance" --port 27017 --dbpath C:\data --logpath C:\data\1.log --smallfiles

Of course you should change the parameters to fit your needs. Make sure that the appropriate folders exist. After installing the service you start it as follows

net start "Mongo DB instance"
2 of 7
5

1) Download the 64 bit version of mongodb

2) Double click the downloaded file to run the installer

3) Look for MongoDB in C drive If you can't find it there, then look in C:\"Program Files" folder Cut and paste the "MongoDB 2.6 Standard" folder from C:\Program Files to C:\ Rename "MongoDB 2.6 Standard" to MongoDB

4) Create C:\data folder

5) Now open command shell to run as Administrator

6) In the command shell you just opened:

A) Browse to C:\MongoDB\bin folder

B) Then run this command: (Change name and folder accordingly) mongod --install --serviceName "Mongo DB2.6 instance" --serviceDisplayName "Mongo DB2.6 instance" --port 27017 --dbpath C:\data --logpath C:\data\1.log --smallfiles

C) To start the service, you can either run this command: net start "Mongo DB2.6 instance" OR type services in the Search for programs and files box. Then look for Mongo DB2.6 instance > right click it and choose Start

D) Verify that you can connect and run command Open a command prompt

       >cd C:\MongoDB\bin (enter)
       >mongo.exe (enter)
       >it will show that it is connected
       >type command "show dbs" and hit enter
       >it will show local and test dbs
🌐
MongoDB
mongodb.com
MongoDB: The World’s Leading Modern Database | MongoDB
On MongoDB, we could automate our deployments and scalability monitoring, and we had advanced features like search charts and an online vector store that didn’t exist in the CouchDB ecosystem.” ... “We use MongoDB as the core database for our services, so any new innovative idea or new service we build, we automatically say, ‘We’re going to use MongoDB as the core platform,’ knowing that it’s going to give us the reliability and the scalability that we’re going to need.”