zoukankan      html  css  js  c++  java
  • MongoDB02 Quickstart Windows 在Windows上试一下吧

    Download

    The 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 binaries

    Download and extract the 32-bit .zip. The "Production" build is recommended.

    64-bit binaries

    Download and extract the 64-bit .zip.

    Unzip

    Unzip 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 directory

    By default MongoDB will store data in \data\db, but it won't automatically create that folder, so we do so here:

    C:\> mkdir \data
    C:\> mkdir \data\db
    

    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 server

    The important binaries for a first run are:

    • mongod.exe - the database server. Try mongod --help to see startup options.
    • mongo.exe - the administrative shell

    To run the database, click mongod.exe in Explorer, or run it from a CMD window.

    C:\> cd \my_mongo_dir\bin
    C:\my_mongo_dir\bin> mongod
    

    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.

    C:\> cd \my_mongo_dir\bin
    C:\my_mongo_dir\bin> mongo
    > // the mongo shell is a javascript shell connected to the db
    > // by default it connects to database 'test' at localhost
    > 3+3
    6
    > db
    test
    > // the first write will create the db:
    > db.foo.insert( { a : 1 } )
    > db.foo.find()
    { _id : ..., a : 1 }
    > show dbs
    ...
    > show collections
    ...
    > help
    

    Congratulations, you've just saved and retrieved your first document with MongoDB!

    Writing Apps

    You 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.

  • 相关阅读:
    Win10 WSL Ubuntu18.04 编译安装MySQL5.7
    PHP7 深入理解
    php session 测试
    nginx 匹配路由分发php和golang
    composer 库无法提交git
    Win10 1803安装Ubuntu1804子系统
    dhtmlxTreeGrid使用
    win7 64位系统下安装PL/SQL连接Oracle服务器的解决方法
    转载--eclipse快捷键
    JUnit4学习笔记2-Eclipse中使用JUint4进行单元测试
  • 原文地址:https://www.cnblogs.com/shined/p/2260914.html
Copyright © 2011-2022 走看看