Preface |
|
xv | |
Acknowledgments |
|
xvii | |
About This Book |
|
xviii | |
About The Cover Illustration |
|
xxi | |
|
|
1 | (52) |
|
1 A database for the modern web |
|
|
3 | (20) |
|
|
5 | (1) |
|
1.2 MongoDB's key features |
|
|
5 | (8) |
|
|
5 | (3) |
|
|
8 | (2) |
|
|
10 | (1) |
|
|
10 | (1) |
|
|
11 | (1) |
|
|
12 | (1) |
|
1.3 MongoDB's core server and tools |
|
|
13 | (3) |
|
|
14 | (1) |
|
|
14 | (1) |
|
|
15 | (1) |
|
|
16 | (1) |
|
|
16 | (5) |
|
MongoDB versus other databases |
|
|
17 | (2) |
|
Use cases and production deployments |
|
|
19 | (2) |
|
|
21 | (1) |
|
|
22 | (1) |
|
2 MongoDB through the JavaScript shell |
|
|
23 | (14) |
|
2.1 Diving into the MongoDB shell |
|
|
24 | (5) |
|
|
24 | (1) |
|
|
25 | (1) |
|
|
26 | (2) |
|
|
28 | (1) |
|
2.2 Creating and querying with indexes |
|
|
29 | (4) |
|
Creating a large collection |
|
|
29 | (2) |
|
|
31 | (2) |
|
|
33 | (2) |
|
Getting database information |
|
|
33 | (1) |
|
|
34 | (1) |
|
|
35 | (1) |
|
|
36 | (1) |
|
3 Writin programs using MongoDB |
|
|
37 | (16) |
|
3.1 MongoDB through the Ruby lens |
|
|
38 | (5) |
|
Installing and connecting |
|
|
38 | (1) |
|
Inserting documents in Ruby |
|
|
39 | (1) |
|
|
40 | (1) |
|
|
41 | (1) |
|
|
42 | (1) |
|
|
43 | (4) |
|
|
43 | (1) |
|
|
44 | (1) |
|
|
45 | (2) |
|
3.3 Building a simple application |
|
|
47 | (5) |
|
|
47 | (1) |
|
|
48 | (2) |
|
|
50 | (2) |
|
|
52 | (1) |
|
PART 2 APPLICATION DEVELOPMENT IN MONGODB |
|
|
53 | (74) |
|
|
55 | (21) |
|
4.1 Principles of schema design |
|
|
56 | (1) |
|
4.2 Designing an e-commerce data model |
|
|
57 | (8) |
|
|
58 | (3) |
|
|
61 | (3) |
|
|
64 | (1) |
|
4.3 Nuts and bolts: on databases, collections, and documents |
|
|
65 | (10) |
|
|
65 | (2) |
|
|
67 | (3) |
|
|
70 | (5) |
|
|
75 | (1) |
|
5 Queries and aggregation |
|
|
76 | (25) |
|
|
77 | (4) |
|
Products, categories, and reviews |
|
|
77 | (2) |
|
|
79 | (2) |
|
5.2 MongoDB's query language |
|
|
81 | (11) |
|
|
81 | (9) |
|
|
90 | (2) |
|
|
92 | (3) |
|
|
92 | (2) |
|
Map-reduce for orders by region |
|
|
94 | (1) |
|
5.4 Aggregation in detail |
|
|
95 | (5) |
|
|
95 | (1) |
|
|
96 | (1) |
|
|
96 | (2) |
|
|
98 | (2) |
|
|
100 | (1) |
|
6 Updates, atomic operations, and deletes |
|
|
101 | (26) |
|
6.1 A brief tour of document updates |
|
|
102 | (2) |
|
|
104 | (8) |
|
|
104 | (4) |
|
|
108 | (2) |
|
|
110 | (2) |
|
6.3 Atomic document processing |
|
|
112 | (6) |
|
|
112 | (2) |
|
|
114 | (4) |
|
6.4 Nuts and bolts: MongoDB updates and deletes |
|
|
118 | (8) |
|
|
118 | (1) |
|
|
119 | (4) |
|
The findAndModify command |
|
|
123 | (1) |
|
|
124 | (1) |
|
Concurrency, atomicity, and isolation |
|
|
124 | (1) |
|
|
125 | (1) |
|
|
126 | (1) |
|
|
127 | (114) |
|
7 Indexing and query optimization |
|
|
129 | (27) |
|
|
130 | (7) |
|
|
130 | (3) |
|
|
133 | (3) |
|
|
136 | (1) |
|
|
137 | (7) |
|
|
138 | (2) |
|
|
140 | (4) |
|
|
144 | (11) |
|
|
144 | (3) |
|
|
147 | (6) |
|
|
153 | (2) |
|
|
155 | (1) |
|
|
156 | (28) |
|
|
157 | (2) |
|
|
157 | (1) |
|
|
158 | (1) |
|
|
159 | (18) |
|
|
159 | (4) |
|
|
163 | (6) |
|
|
169 | (8) |
|
8.3 Master-slave replication |
|
|
177 | (1) |
|
8.4 Drivers and replication |
|
|
177 | (6) |
|
|
177 | (2) |
|
|
179 | (2) |
|
|
181 | (1) |
|
|
182 | (1) |
|
|
183 | (1) |
|
|
184 | (34) |
|
|
185 | (5) |
|
|
185 | (2) |
|
|
187 | (3) |
|
9.2 A sample shard cluster |
|
|
190 | (10) |
|
|
191 | (4) |
|
Writing to a sharded cluster |
|
|
195 | (5) |
|
9.3 Querying and indexing a shard cluster |
|
|
200 | (5) |
|
|
200 | (4) |
|
|
204 | (1) |
|
|
205 | (3) |
|
|
205 | (2) |
|
|
207 | (1) |
|
9.5 Sharding in production |
|
|
208 | (9) |
|
Deployment and configuration |
|
|
208 | (4) |
|
|
212 | (5) |
|
|
217 | (1) |
|
10 Deployment and administration |
|
|
218 | (23) |
|
|
219 | (9) |
|
|
219 | (4) |
|
|
223 | (2) |
|
|
225 | (1) |
|
|
226 | (2) |
|
10.2 Monitoring and diagnostics |
|
|
228 | (6) |
|
|
228 | (1) |
|
|
229 | (3) |
|
External monitoring applications |
|
|
232 | (1) |
|
Diagnostic tools (mongosniff, bsondump) |
|
|
233 | (1) |
|
|
234 | (3) |
|
|
234 | (1) |
|
|
235 | (1) |
|
|
236 | (1) |
|
10.4 Performance troubleshooting |
|
|
237 | (3) |
|
Check indexes and queries for efficiency |
|
|
238 | (1) |
|
|
238 | (1) |
|
Increase disk performance |
|
|
239 | (1) |
|
|
239 | (1) |
|
Seek professional assistance |
|
|
240 | (1) |
|
|
240 | (1) |
Appendix A Installation |
|
241 | (8) |
Appendix B Design patterns |
|
249 | (11) |
Appendix C Binary data and GridFS |
|
260 | (6) |
Appendix D MongoDB in PHP, Java, and C++ |
|
266 | (8) |
Appendix E Spatial indexing |
|
274 | (5) |
Index |
|
279 | |