MongoDB (from "humongous") is a cross-platform document-oriented database system. Classified as a NoSQL database, MongoDB eschews the traditional table-based relational database structure in favor of JSON-like documents with dynamic schemas
Introduction
In this article we will learn how to run mongoDB as a service.we will also see how to connect to the service and get started.Previous articles have provided an introduction to mongodb and the set up and installation,and few command line options.You can get them from the following:Objective
The objective of the article is to learn how to install mongo database as a service and get started.
Install as a Service
Till now we have been using the commands to start and stop the mongo server.If we want the mongo server to be running all the time may be even when the system starts up.On a windows machine we can install mongo as a service.
Lets look installing it as a service
we have already created a configuration file in our previous article
- Step 1 Open command prompt in administrator mode fetch to the mongo directory and type the following command
mongod -f c:\dotnetfunda\mongod.conf --install
Its installed as a service
we can start the service by issuing net start mongodb
If we want to check the mongo server is running or not we can use the following command
net start | findstr Mongo
we can find the Mongo service listed as shown below
we can also stop the service by the following command
Thats it now we have the Mongo server up and running we can connect to it using the monogo shell. Since we are running the server on local machine and on default port we no need to specify any command line arguments to the shell,we can simply connect by typing mongo.
Let check the database inside mongo lets connect to server and we can check the databases by the command
show dbs
It will show that we have exactly one local database..
Conclusion
In this article we have seen how to install mongo as a service and get started.In coming articles we will know about replica sets in Mongo.
Reference
http://en.wikipedia.org/wiki/MongoDB
http://www.mongodb.org/