DownloadThe easiest (and recommended) way to install MongoDB is to use the pre-built binaries. Note: 64-bit is recommended, although you must have a 64-bit version of Windows to run that version. 最好装在64位上,在32位模式运行时支持的最大文件尺寸为2GB 32-bit binariesDownload and extract the 32-bit .zip. The "Production" build is recommended. 64-bit binariesDownload and extract the 64-bit .zip. UnzipUnzip the downloaded binary package to the location of your choice. You may want to rename mongo-xxxxxxx to just "mongo" for convenience. Create a data directoryBy default MongoDB will store data in \data\db, but it won't automatically create that folder, so we do so here:
Or you can do this from the Windows Explorer, of course. If you prefer to place datafiles elsewhere, use the --dbpath command line parameter when starting mongod.exe. Run and connect to the serverThe important binaries for a first run are:
To run the database, click mongod.exe in Explorer, or run it from a CMD window.
Note: It is also possible to run the server as a Windows Service. But we can do that later. Now, start the administrative shell, either by double-clicking mongo.exe in Explorer, or from the CMD prompt. By default mongo.exe connects to a mongod server running on localhost and uses the database named test. Run mongo --help to see other options.
Congratulations, you've just saved and retrieved your first document with MongoDB! Writing AppsYou can write apps that use MongoDB in virtual any programming language. See the Drivers page for a full list, and also the C# page if writing .NET applications. |
转载于:https://www.cnblogs.com/shined/archive/2011/11/23/2260914.html