没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
MongoDB Documentation
Release 2.4.5
MongoDB Documentation Project
August 01, 2013
Contents
I Install MongoDB 1
1 Installation Guides 3
1.1 Install MongoDB on Red Hat Enterprise, CentOS, or Fedora Linux . . . . . . . . . . . . . . . . . . 3
1.2 Install MongoDB on Ubuntu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.3 Install MongoDB on Debian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.4 Install MongoDB on Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.5 Install MongoDB on OS X . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.6 Install MongoDB on Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
1.7 Install MongoDB Enterprise . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2 Upgrade MongoDB 23
2.1 Upgrade to the Latest Revision of MongoDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3 Release Notes 27
4 First Steps with MongoDB 29
4.1 Getting Started with MongoDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.2 Generate Test Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
II Core MongoDB Operations (CRUD) 37
5 Read and Write Operations in MongoDB 41
5.1 Read Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
5.2 Write Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
5.3 Write Concern Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
6 Fundamental Concepts for Document Databases 61
6.1 BSON Documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
6.2 ObjectId . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
6.3 GridFS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
6.4 Database References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
7 CRUD Operations for MongoDB 75
7.1 Create . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
7.2 Read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
7.3 Update . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
7.4 Delete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
i
III Data Modeling 103
8 Background 107
8.1 Data Modeling Considerations for MongoDB Applications . . . . . . . . . . . . . . . . . . . . . . . 107
9 Data Modeling Patterns 113
9.1 Model Embedded One-to-One Relationships Between Documents . . . . . . . . . . . . . . . . . . . 113
9.2 Model Embedded One-to-Many Relationships Between Documents . . . . . . . . . . . . . . . . . . 114
9.3 Model Referenced One-to-Many Relationships Between Documents . . . . . . . . . . . . . . . . . . 115
9.4 Model Data for Atomic Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
9.5 Model Tree Structures with Parent References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
9.6 Model Tree Structures with Child References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
9.7 Model Tree Structures with an Array of Ancestors . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
9.8 Model Tree Structures with Materialized Paths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
9.9 Model Tree Structures with Nested Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
9.10 Model Data to Support Keyword Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
IV Administration 125
10 Background 129
10.1 Run-time Database Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
10.2 Backup and Recovery Operations for MongoDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
10.3 Data Center Awareness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
10.4 Journaling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
10.5 Monitoring for MongoDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
10.6 Import and Export MongoDB Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
11 Processes 171
11.1 MongoDB Tutorials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
11.2 Analyze Performance of Database Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
11.3 Use Database Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
11.4 Connect to MongoDB with SSL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
11.5 Monitor MongoDB with SNMP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
11.6 Manage mongod Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
11.7 Rotate Log Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
12 Reference 193
12.1 UNIX ulimit Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
12.2 Production Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
V Security 203
13 Security Concepts and Strategies 207
13.1 Security Practices and Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
13.2 Access Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
13.3 Inter-Process Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
14 Tutorials 215
14.1 Network Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
14.2 Access Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
15 Reference 233
15.1 User Privilege Roles in MongoDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
ii
15.2 system.users Privilege Documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
15.3 Password Hashing Insecurity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
VI Aggregation 243
16 Aggregation Framework 247
16.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
16.2 Framework Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
16.3 Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
16.4 Optimizing Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
16.5 Sharded Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
16.6 Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
17 Aggregation Framework Examples 253
17.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
17.2 Aggregations using the Zip Code Data Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
17.3 Aggregation with User Preference Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
18 Aggregation Framework Reference 263
18.1 Pipeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
18.2 Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
19 SQL to Aggregation Framework Mapping Chart 287
19.1 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
20 Map-Reduce 291
20.1 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
20.2 Temporary Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
20.3 Concurrency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
20.4 Sharded Cluster . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
20.5 Troubleshooting Map-Reduce Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
21 Simple Aggregation Methods and Commands 303
21.1 Count . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
21.2 Distinct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
21.3 Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
VII Indexes 305
22 Index Concepts 309
22.1 Indexing Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
23 Indexing Strategies for Applications 321
23.1 Indexing Strategies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
24 Index Tutorials 329
24.1 Indexing Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
25 Geospatial Indexing 339
25.1 Geospatial Indexes and Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
26 Text Indexing 353
26.1 Text Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
iii
剩余1278页未读,继续阅读
资源评论
btaabbcc
- 粉丝: 0
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功