日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

MongoDB初学

發布時間:2025/3/21 41 豆豆
生活随笔 收集整理的這篇文章主要介紹了 MongoDB初学 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

參考:MongoDB?教程 | 菜鳥教程

安裝

1.下載安裝,從官網下載winows安裝包,安裝到d盤(注意路徑)

2.由于我安裝在d盤,所以在d盤創建文件夾data,里面創建db文件夾

3.啟動方法:在D:\Program Files\MongoDB\Server\3.2\bin下雙擊mongod.exe,如下則顯示正常:

2016-04-15T21:24:08.293+0800 I CONTROL [initandlisten] MongoDB starting : pid=6276 port=27017 dbpath=D:\data\db\ 64-bit host=DESKTOP-LPJTSPF 2016-04-15T21:24:08.295+0800 I CONTROL [initandlisten] targetMinOS: Windows Vista/Windows Server 2008 2016-04-15T21:24:08.295+0800 I CONTROL [initandlisten] db version v3.2.5 2016-04-15T21:24:08.296+0800 I CONTROL [initandlisten] git version: 34e65e5383f7ea1726332cb175b73077ec4a1b02 2016-04-15T21:24:08.296+0800 I CONTROL [initandlisten] allocator: tcmalloc 2016-04-15T21:24:08.296+0800 I CONTROL [initandlisten] modules: none 2016-04-15T21:24:08.296+0800 I CONTROL [initandlisten] build environment: 2016-04-15T21:24:08.297+0800 I CONTROL [initandlisten] distarch: x86_64 2016-04-15T21:24:08.297+0800 I CONTROL [initandlisten] target_arch: x86_64 2016-04-15T21:24:08.297+0800 I CONTROL [initandlisten] options: {} 2016-04-15T21:24:08.297+0800 I - [initandlisten] Detected data files in D:\data\db\ created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'. 2016-04-15T21:24:08.298+0800 W - [initandlisten] Detected unclean shutdown - D:\data\db\mongod.lock is not empty. 2016-04-15T21:24:08.298+0800 W STORAGE [initandlisten] Recovering data from the last clean checkpoint. 2016-04-15T21:24:08.299+0800 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=4G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0), 2016-04-15T21:24:08.464+0800 I CONTROL [initandlisten] 2016-04-15T21:24:08.465+0800 I CONTROL [initandlisten] ** WARNING: Insecure configuration, access control is not enabled and no --bind_ip has been specified. 2016-04-15T21:24:08.465+0800 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted, 2016-04-15T21:24:08.465+0800 I CONTROL [initandlisten] ** and the server listens on all available network interfaces. 2016-04-15T21:24:08.465+0800 I CONTROL [initandlisten] 2016-04-15T21:24:08.467+0800 I NETWORK [HostnameCanonicalizationWorker] Starting hostname canonicalization worker 2016-04-15T21:24:08.467+0800 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory 'D:/data/db/diagnostic.data' 2016-04-15T21:24:08.468+0800 I NETWORK [initandlisten] waiting for connections on port 27017 2016-04-15T21:24:09.023+0800 I FTDC [ftdc] Unclean full-time diagnostic data capture shutdown detected, found interim file, some metrics may have been lost. OK 2016-04-15T21:24:19.975+0800 I NETWORK [initandlisten] connection accepted from 127.0.0.1:13732 #1 (1 connection now open)

若一閃而過則因為默認在d盤下的data/db文件夾未找到。如果你不想將db放在d:/data/db下也可以指定db位置:

cmd 進入d盤,cd?Program Files\MongoDB\Server\3.2\bin,mongod.exe dbpath 指定的位置

這樣也可以開啟數據庫。

4.打開客戶端。雙擊bin目錄下的mongo.exe,若不閃退則啟動成功。

5.測試:

> db test > 1+2 3 > db.runoob.insert({x:10}) WriteResult({ "nInserted" : 1 }) > db.runoob.find() { "_id" : ObjectId("5710e88c34bf37767b29a10e"), "x" : 10 }

  

?





唯有不斷學習方能改變! -- Ryan Miao

總結

以上是生活随笔為你收集整理的MongoDB初学的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。