Professional Documents
Culture Documents
org/>
Toggle navigation
*
*
*
*
*
*
Docs <http://docs.mongodb.org>
Try It Out <http://try.mongodb.org>
Downloads <http://www.mongodb.org/downloads>
Community <http://www.mongodb.org/get-involved>
Blog <http://blog.mongodb.org>
<javascript:void(0)>
powered by
1.
Go /Start Menu/ > /All Programs/ > /Accessories/.
2.
Right click /Command Prompt/, and select /Run as Administrator/
from the popup menu.
3.
In the /Command Prompt/, issue the following commands:
cd \
move C:\mongodb-win32-* C:\mongodb
Note
MongoDB is self-contained and does not have any other system
dependencies. You can run MongoDB from any folder you choose. You may
install MongoDB in any directory (e.g. D:\test\mongodb)
Run MongoDB <#run-mongodb>
Set Up the Data Directory <#set-up-the-data-directory>
MongoDB requires a /data folder/ <../../reference/glossary/#term-dbpath>
to store its files. The default location for the MongoDB data directory
is C:\data\db. Create this folder using the /Command Prompt/. Go to the
C:\ directory and issue the following command sequence:
md data
md data\db
You can specify an alternate path for data files using the /--dbpath/
option to mongod.exe <../../reference/program/mongod.exe/#bin.mongod.exe>.
Start MongoDB <#start-mongodb>
To start MongoDB, execute from the /Command Prompt/:
C:\mongodb\bin\mongod.exe
This will start the main MongoDB database process. The waiting for
connections message in the console output indicates that the mongod.exe
process is running successfully.
Note
Depending on the security level of your system, Windows will issue a
/Security Alert/ dialog box about blocking some features of
C:\\mongodb\bin\mongod.exe from communicating on networks. All users
should select Private Networks, such as my home or work network and
click Allow access. For additional information on security and MongoDB,
please read the /Security Concepts/ <../../core/security/> page.
Warning
Do not allow mongod.exe
<../../reference/program/mongod.exe/#bin.mongod.exe> to be accessible to
public networks without running in Secure Mode (i.e. auth
<../../reference/configuration-options/#auth>.) MongoDB is designed to
be run in trusted environments and the database does not enable
authentication or Secure Mode by default.
You may specify an alternate path for \data\db with the dbpath
<../../reference/configuration-options/#dbpath> setting for mongod.exe
<../../reference/program/mongod.exe/#bin.mongod.exe>, as in the
following example:
C:\mongodb\bin\mongod.exe --dbpath d:\test\mongodb\data
If your path includes spaces, enclose the entire path in double
quotations, for example:
C:\mongodb\bin\mongod.exe --dbpath "d:\test\mongo db data"
Connect to MongoDB <#connect-to-mongodb>
Connect to MongoDB using the mongo.exe
<../../reference/program/mongo/#bin.mongo> shell. Open another /Command
Prompt/ and issue the following command:
C:\mongodb\bin\mongo.exe
Note
Executing the command start C:\mongodb\bin\mongo.exe will automatically
start the mongo.exe shell in a separate /Command Prompt/ window.
The mongo.exe <../../reference/program/mongo/#bin.mongo> shell will
connect to mongod.exe
<../../reference/program/mongod.exe/#bin.mongod.exe> running on the
localhost interface and port 27017 by default. At the mongo.exe
<../../reference/program/mongo/#bin.mongo> prompt, issue the following
two commands to insert a record in the test /collection/
<../../reference/glossary/#term-collection> of the default test database
and then retrieve that record:
db.test.save( { a: 1 } )
db.test.find()
See also
mongo <../../reference/program/mongo/#bin.mongo> and /mongo Shell
Methods/ <../../reference/method/>. If you want to develop applications
using .NET, see the documentation of C# and MongoDB
<http://docs.mongodb.org/ecosystem/drivers/csharp> for more information.
MongoDB as a Windows Service <#mongodb-as-a-windows-service>
New in version 2.0.
You can set up MongoDB as a /Windows Service/ so that the database will
Introduction <http://www.mongodb.org/about/introduction>
User Community <http://www.mongodb.org/about/community>
MongoDB Masters <http://mongodb.org/about/community/masters>
Planet MongoDB <http://planet.mongodb.org>
MongoDB Resources
*
*
*
*
Downloads <http://www.mongodb.org/downloads>
MongoDB Events <http://www.mongodb.com/events>
Slides and Video <http://www.mongodb.com/presentations>
MongoDB Management Service
<https://mms.mongodb.com/?pk_campaign=mongodb-docs-resources-footer>
(docs <http://mms.mongodb.com/help/>)
MongoDB Ecosystem <http://docs.mongodb.org/ecosystem/>
<http://docs.mongodb.org/ecosystem/drivers/>
* Tools and Integration <http://docs.mongodb.org/ecosystem/tools/>
* Platform Integration <http://docs.mongodb.org/ecosystem/platforms/>
* Use Cases <http://docs.mongodb.org/ecosystem/use-cases/>
MongoDB Drivers <http://docs.mongodb.org/ecosystem/drivers/>
* C <http://docs.mongodb.org/ecosystem/drivers/c> (docs
<http://api.mongodb.org/c/current/>)
* C++ <http://docs.mongodb.org/ecosystem/drivers/cpp> (docs
<http://api.mongodb.org/cplusplus/current/>)
* C# <http://docs.mongodb.org/ecosystem/drivers/csharp> (docs
<http://api.mongodb.org/csharp/current/>)
* Erlang <http://docs.mongodb.org/ecosystem/drivers/erlang> (docs
<http://api.mongodb.org/erlang>)
* Haskell <http://hackage.haskell.org/package/mongoDB> (docs
<http://api.mongodb.org/haskell>)
* Java <http://docs.mongodb.org/ecosystem/drivers/java> (docs
<http://api.mongodb.org/java/current>)
* JavaScript <http://docs.mongodb.org/ecosystem/drivers/javascript>
(docs <http://api.mongodb.org/js/current>)
* Perl <http://docs.mongodb.org/ecosystem/drivers/perl> (docs
<https://metacpan.org/module/MongoDB>)
* PHP <http://docs.mongodb.org/ecosystem/drivers/php> (docs
<http://php.net/mongo/>)
* Python <http://docs.mongodb.org/ecosystem/drivers/python> (docs
<http://api.mongodb.org/python/current>)
* Ruby <http://docs.mongodb.org/ecosystem/drivers/ruby> (docs
<http://api.mongodb.org/ruby/current>)
* Scala <http://docs.mongodb.org/ecosystem/drivers/scala> (docs
<http://api.mongodb.org/scala/casbah/current/>)
Copyright 2013 MongoDB, Inc <http://www.mongodb.com>. Licensed under
Creative Commons <http://creativecommons.org/licenses/by-nc-sa/3.0/ >.
MongoDB, Mongo, and the leaf logo are registered trademarks of MongoDB, Inc.
<https://twitter.com/mongodbinc>
<http://www.youtube.com/user/MongoDB>
<https://www.facebook.com/mongodb>
<https://plus.google.com/u/1/101024085748034940765/posts?cfem=1>