Preface

How This Book Is Organized

Getting Up to Speed with MongoDB

In Chapter 1, Introduction, we provide some background about MongoDB: why it was created, the goals it is trying to accomplish, and why you might choose to use it for a project. We go into more detail in Chapter 2, Getting Started, which provides an introduction to the core concepts and vocabulary of MongoDB. Chapter 2 also provides a first look at working with MongoDB, getting you started with the database and the shell.

Developing with MongoDB

The next two chapters cover the basic material that developers need to know to work with MongoDB. In Chapter 3, Creating, Updating, and Deleting Documents, we describe how to perform those basic write operations, including how to do them with different levels of safety and speed. Chapter 4, Querying, explains how to find documents and create complex queries. This chapter also covers how to iterate through results and options for limiting, skipping, and sorting results.

Advanced Usage

The next three chapters go into more complex usage than simply storing and retrieving data. Chapter 5, Indexing, explains what indexes are and how to use them with MongoDB. It also covers tools you can use to examine or modify the indexes used to perform a query, and it covers index administration. Chapter 6, Aggregation, covers a number of techniques for aggregating data with MongoDB, including counting, finding distinct values, grouping documents, and using MapReduce. Chapter 7, Advanced Topics, is a mishmash of important tidbits that didn’t fit into any of the previous categories: file storage, server-side JavaScript, database commands, and database references.

Administration

The next three chapters are less about programming and more about the operational aspects of MongoDB. Chapter 8, Administration, discusses options for starting the database in different ways, monitoring a MongoDB server, and keeping deployments secure. Chapter 8 also covers how to keep proper backups of the data you’ve stored in MongoDB. In Chapter 9, Replication, we explain how to set up replication with MongoDB, including standard master-slave configuration and setups with automatic failover. This chapter also covers how MongoDB replication works and options for tweaking it. Chapter 10, Sharding, describes how to scale MongoDB horizontally: it covers what autosharding is, how to set it up, and the ways in which it impacts applications.

Developing Applications with MongoDB

In Chapter 11, Example Applications, we provide example applications using MongoDB, written in Java, PHP, Python, and Ruby. These examples illustrate how to map the concepts described earlier in the book to specific languages and problem domains.

Appendixes

Appendix A, explains MongoDB’s versioning scheme and how to install it on Windows, OS X, and Linux. Appendix B, includes some useful shell tips and tools. Finally, Appendix C, details a little about how MongoDB works internally: its storage engine, data format, and wire protocol.

Conventions Used in This Book

The following typographical conventions are used in this book:

Italic

Indicates new terms, URLs, email addresses, collection names, database names, filenames, and file extensions.

Constant width

Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, command-line utilities, environment variables, statements, and keywords.

Constant width bold

Shows commands or other text that should be typed literally by the user.

Constant width italic

Shows text that should be replaced with user-supplied values or by values determined by context.

Tip

This icon signifies a tip, suggestion, or general note.

Caution

This icon indicates a warning or caution.

Using Code Examples

This book can help you get your job done. In general, you may use the code in this book in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission.

We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “MongoDB: The Definitive Guide by Kristina Chodorow and Michael Dirolf (O’Reilly). Copyright 2010 Kristina Chodorow and Michael Dirolf, 978-1-449-38156-1.”

If you feel your use of code examples falls outside fair use or the permission given here, feel free to contact us at .

Safari® Books Online

Note

Safari Books Online is an on-demand digital library that lets you easily search more than 7,500 technology and creative reference books and videos to find the answers you need quickly.

With a subscription, you can read any page and watch any video from our library online. Read books on your cell phone and mobile devices. Access new titles before they are available for print, and get exclusive access to manuscripts in development and post feedback for the authors. Copy and paste code samples, organize your favorites, download chapters, bookmark key sections, create notes, print out pages, and benefit from tons of other time-saving features.

O’Reilly Media has uploaded this book to the Safari Books Online service. To have full digital access to this book and others on similar topics from O’Reilly and other publishers, sign up for free at http://my.safaribooksonline.com.

How to Contact Us

Please address comments and questions concerning this book to the publisher:

O’Reilly Media, Inc.
1005 Gravenstein Highway North
Sebastopol, CA 95472
800-998-9938 (in the United States or Canada)
707-829-0515 (international or local)
707 829-0104 (fax)

We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at:

http://www.oreilly.com/catalog/9781449381561

To comment or ask technical questions about this book, send email to:

For more information about our books, conferences, Resource Centers, and the O’Reilly Network, see our website at:

http://www.oreilly.com

Acknowledgments

We would like to thank Eliot Horowitz and Dwight Merriman, who made all of this possible by starting the MongoDB project. We’d also like to thank our tech reviewers: Alberto Lerner, Mathias Stearn, Aaron Staple, James Avery, and John Hornbeck. You guys made this book immeasurably better (and more correct). Thank you, Julie Steele, for being such a terrific editor and for helping us every step of the way. Thanks to everybody else at O’Reilly who helped get this book into production. Finally, a big thanks is owed to the entire MongoDB community, which has supported the project (and this book) from the very beginning.

Acknowledgments from Kristina

Thanks to all of my co-workers at 10gen for sharing your knowledge and advice on MongoDB (as well as your advice on ops, beer, and plane crashes). Also, thank you, Mike, for magically making half of this book appear and correcting some of my more embarrassing errors before Julie saw them. Finally, I would like to thank Andrew, Susan, and Andy for all of their support, patience, and suggestions. I couldn’t have done it without you guys.

Acknowledgments from Michael

Thanks to all of my friends, who have put up with me during this process (and in general). Thanks to everyone I’ve worked with at 10gen for making working on MongoDB a blast. Thank you, Kristina, for being such a great coauthor. Most importantly, I would like to thank my entire family for all of their support with this and everything I undertake.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.36.71