第十四章 安裝 MongoDB
Docker 安裝 MongoDB 教學
1. 前言介紹
2. 環境需求
3. 拉取 MongoDB Docker 映像檔
# 適用於 Windows PowerShell、Mac/Linux Terminal
docker pull mongo4. 建立 MongoDB 容器
(1)一般啟動範例
# 適用於 Windows PowerShell、Mac/Linux Terminal
docker run -d \
--name mongodb \
-p 27017:27017 \
-e MONGO_INITDB_ROOT_USERNAME=mongoadmin \
-e MONGO_INITDB_ROOT_PASSWORD=secret123 \
mongo5. 資料持久化 (可選)
(1)Mac / Linux 指令
(2)Windows 指令
6. 連線測試
(1) 使用 mongo shell
(2) 使用 MongoDB GUI (如 Compass)
7. 常用指令
8. 小結與補充
MongoDB Compass 圖形化操作教學
1. 安裝 MongoDB Compass
2. 連線到本地 MongoDB
3. 建立新的資料庫與集合
4. 新增文件(新增一筆資料)
5. 查詢資料
6. 編輯資料
7. 刪除資料
8. 新增欄位(欄位動態擴充)
9. 匯入/匯出資料
10. 小結
MongoDB 常用語法教學
1. 切換(建立)資料庫
2. 建立集合(Collection)
3. 新增資料(Insert)
4. 查詢資料(Find)
5. 更新資料(Update)
6. 刪除資料(Delete)
7. 欄位操作
8. 聚合查詢(Aggregation)
9. 索引(Index)
10. 常見運算子速查表
運算子
說明
範例
11. 其他補充
Last updated