Spring Data MongoDB - Reference Documentation


Mark Pollack, Thomas Risberg, Oliver Gierke, Costin Leau, Jon Brisbin


Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically.

Table of Contents

I. Introduction
1. Why Spring Data - Document?
2. Requirements
3. Additional Help Resources
3.1. Support
3.1.1. Community Forum
3.1.2. Professional Support
3.2. Following Development
4. Working with Spring Data Repositories
4.1. Core concepts
4.2. Query methods
4.2.1. Defining repository interfaces
Fine-tuning repository definition
4.2.2. Defining query methods
Query lookup strategies
Query creation
Property expressions
Special parameter handling
4.2.3. Creating repository instances
XML configuration
Standalone usage
4.3. Custom implementations for Spring Data repositories
4.3.1. Adding custom behavior to single repositories
4.3.2. Adding custom behavior to all repositories
4.4. Spring Data extensions
4.4.1. Domain class web binding for Spring MVC
4.4.2. Web pagination
4.4.3. Repository populators
II. Reference Documentation
5. MongoDB support
5.1. Getting Started
5.2. Examples Repository
5.3. Connecting to MongoDB with Spring
5.3.1. Registering a Mongo instance using Java based metadata
5.3.2. Registering a Mongo instance using XML based metadata
5.3.3. The MongoDbFactory interface
5.3.4. Registering a MongoDbFactory instance using Java based metadata
5.3.5. Registering a MongoDbFactory instance using XML based metadata
5.4. Introduction to MongoTemplate
5.4. . Instantiating MongoTemplate
WriteResultChecking Policy
5.5. Saving, Updating, and Removing Documents
5.5.1. How the '_id' field is handled in the mapping layer
5.5.2. Type mapping
5.5.3. Methods for saving and inserting documents
Which collection will my documents be saved into?
Inserting or saving individual objects
Inserting several objects in a batch
5.5.4. Updating documents in a collection
Methods for executing updates for documents
Methods for the Update class
5.5.5. Upserting documents in a collection
5.5.6. Finding and Upserting documents in a collection
5.5.7. Methods for removing documents
5.6. Querying Documents
5.6.1. Querying documents in a collection
Methods for the Criteria class
Methods for the Query class
5.6.2. Methods for querying for documents
5.6.3. GeoSpatial Queries
Geo near queries
5.7. Map-Reduce Operations
5.7.1. Example Usage
5.8. Group Operations
5.8.1. Example Usage
5.9. Overriding default mapping with custom converters
5.9.1. Saving using a registered Spring Converter
5.9.2. Reading using a Spring Converter
5.9.3. Registering Spring Converters with the MongoConverter
5.9.4. Converter disambiguation
5.10. Index and Collection managment
5.10.1. Methods for creating an Index
5.10.2. Accessing index information
5.10.3. Methods for working with a Collection
5.11. Executing Commands
5.11.1. Methods for executing commands
5.12. Lifecycle Events
5.13. Exception Translation
5.14. Execution callbacks
5.15. GridFS support
6. MongoDB repositories
6.1. Introduction
6.2. Usage
6.3. Query methods
6.3.1. Geo-spatial repository queries
6.3.2. MongoDB JSON based query methods and field restriction
6.3.3. Type-safe Query methods
7. Mapping
7.1. Convention based Mapping
7.1.1. How the '_id' field is handled in the mapping layer
7.2. Mapping Configuration
7.3. Metadata based Mapping
7.3.1. Mapping annotation overview
7.3.2. Compound Indexes
7.3.3. Using DBRefs
7.3.4. Mapping Framework Events
7.3.5. Overriding Mapping with explicit Converters
8. Cross Store support
8.1. Cross Store Configuration
8.2. Writing the Cross Store Application
9. Logging support
9.1. MongoDB Log4j Configuration
10. JMX support
10.1. MongoDB JMX Configuration
III. Appendix
A. Namespace reference
A.1. The <repositories /> element
B. Repository query keywords
B.1. Supported query keywords