Skip to content
Browse files

Merge branch 'master' of https://github.com/karlseguin/the-little-mon…

…godb-book

Conflicts:
	readme.markdown
  • Loading branch information...
2 parents fe70159 + 95524d2 commit 1a26fbe6ab9131f8956995b351f049cce485f970 @uokesita committed
Showing with 14 additions and 10 deletions.
  1. +5 −0 Makefile
  2. +6 −3 en/mongodb.markdown
  3. BIN en/title.psd
  4. +2 −0 en/title.txt
  5. +1 −7 makefile
View
5 Makefile
@@ -0,0 +1,5 @@
+en/mongodb.epub: en/title.txt en/mongodb.markdown
+ pandoc -o $@ $^
+
+en/mongodb.mobi: en/mongodb.epub
+ kindleGen $^
View
9 en/mongodb.markdown
@@ -310,7 +310,7 @@ Now let's add a couple employees and set their manager as `Leto`:
db.employees.insert({_id: ObjectId("4d85c7039ab0fd70a117d732"), name: 'Moneo', manager: ObjectId("4d85c7039ab0fd70a117d730")});
-(It's worth repeating that the `_id` can be any any unique value. Since you'd likely use an `ObjectId` in real life, we'll use them here as well.)
+(It's worth repeating that the `_id` can be any unique value. Since you'd likely use an `ObjectId` in real life, we'll use them here as well.)
Of course, to find all of Leto's employees, one simply executes:
@@ -421,6 +421,9 @@ MongoDB relies on MapReduce for most data processing jobs. It has some [basic ag
Of course, parallelizing data processing isn't something relational databases excel at either. There are plans for future versions of MongoDB to be better at handling very large sets of data.
+### Geospatial ###
+A particularly powerful feature of MongoDB is its support for geospatial indexes. This allows you to store x and y coordinates within documents and then find documents that are `$near` a set of coordinates or `$within` a box or circle. This is a feature best explained via some visual aids, so I invite you to try the [5 minute geospatial interactive tutorial](http://mongly.com/geo/index), if you want to learn more.
+
### Tools and Maturity ###
You probably already know the answer to this, but MongoDB is obviously younger than most relational database systems. This is absolutely something you should consider. How much a factor it plays depends on what you are doing and how you are doing it. Nevertheless, an honest assessment simply can't ignore the fact that MongoDB is younger and the available tooling around isn't great (although the tooling around a lot of very mature relational databases is pretty horrible too!). As an example, the lack of support for base-10 floating point numbers will obviously be a concern (though not necessarily a show-stopper) for systems dealing with money.
@@ -609,7 +612,7 @@ A unique index can be created by supplying a second parameter and setting `uniqu
Indexes can be created on embedded fields (again, using the dot-notation) and on array fields. We can also create compound indexes:
- db.unicorns.dropIndex({name: 1, vampires: -1});
+ db.unicorns.ensureIndex({name: 1, vampires: -1});
The order of your index (1 for ascending, -1 for descending) doesn't matter for a single key index, but it can have an impact for compound indexes when you are sorting or using a range condition.
@@ -666,7 +669,7 @@ You can disable the profiler by calling `setProfileLevel` again but changing the
db.setProfilingLevel(1, 1000);
### Backups and Restore ###
-Within the MongoDB `bin` folder is a `mongodump` executable. Simply executing `mongodbump` will connect to localhost and backup all of your databases to a `dump` subfolder. You can type `mongodump --help` to see additional options. Common options are `--db DBNAME` to back up a specific database and `--collection COLLECTIONAME` to back up a specific collection. You can then use the `mongorestore` executable, located in the same `bin` folder, to restore a previously made backup. Again, the `--db` and `--collection` can be specified to restore a specific database and/or collection.
+Within the MongoDB `bin` folder is a `mongodump` executable. Simply executing `mongodump` will connect to localhost and backup all of your databases to a `dump` subfolder. You can type `mongodump --help` to see additional options. Common options are `--db DBNAME` to back up a specific database and `--collection COLLECTIONAME` to back up a specific collection. You can then use the `mongorestore` executable, located in the same `bin` folder, to restore a previously made backup. Again, the `--db` and `--collection` can be specified to restore a specific database and/or collection.
For example, to back up our `learn` collection to a `backup` folder, we'd execute (this is its own executable which you run in a command/terminal window, not within the mongo shell itself):
View
BIN en/title.psd
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
2 en/title.txt
@@ -0,0 +1,2 @@
+% The Little MongoDB Book
+% Karl Seguin
View
8 makefile
@@ -2,10 +2,4 @@ en/mongodb.epub: en/title.txt en/mongodb.markdown
pandoc -o $@ $^
en/mongodb.mobi: en/mongodb.epub
- kindleGen $^
-
-es/mongodb.epub: es/title.txt es/mongodb.markdown
- pandoc -o $@ $^
-
-es/mongodb.mobi: es/mongodb.epub
- kindleGen $^
+ kindleGen $^

0 comments on commit 1a26fbe

Please sign in to comment.
Something went wrong with that request. Please try again.