Spring Data MongoDB - Spring Web Services - Parent - SpringSource

Spring Data MongoDB - Spring Web Services - Parent - SpringSource Spring Data MongoDB - Spring Web Services - Parent - SpringSource

static.springsource.org
from static.springsource.org More from this publisher
13.07.2015 Views

please define productname in your docbook file!Table of ContentsPreface ...................................................................................................................................... vI. Introduction ............................................................................................................................. 11. Why Spring Data - Document? ....................................................................................... 22. Requirements ................................................................................................................. 33. Additional Help Resources .............................................................................................. 43.1. Support ............................................................................................................... 4Community Forum .............................................................................................. 4Professional Support .......................................................................................... 43.2. Following Development ........................................................................................ 44. Working with Spring Data Repositories ............................................................................ 54.1. Core concepts ..................................................................................................... 54.2. Query methods ................................................................................................... 6Defining repository interfaces .............................................................................. 7Fine-tuning repository definition ................................................................... 7Defining query methods ...................................................................................... 7Query lookup strategies .............................................................................. 8Query creation ........................................................................................... 8Property expressions .................................................................................. 9Special parameter handling ........................................................................ 9Creating repository instances ............................................................................ 10XML configuration .................................................................................... 10JavaConfig ............................................................................................... 11Standalone usage .................................................................................... 114.3. Custom implementations for Spring Data repositories ........................................... 11Adding custom behavior to single repositories .................................................... 12Adding custom behavior to all repositories ......................................................... 134.4. Spring Data extensions ...................................................................................... 15Web support .................................................................................................... 15Basic web support .................................................................................... 15Hypermedia support for Pageables ............................................................ 17Repository populators ....................................................................................... 18Legacy web support ......................................................................................... 19Domain class web binding for Spring MVC ................................................ 19Web pagination ........................................................................................ 21II. Reference Documentation ..................................................................................................... 245. MongoDB support ........................................................................................................ 255.1. Getting Started .................................................................................................. 255.2. Examples Repository ......................................................................................... 285.3. Connecting to MongoDB with Spring .................................................................. 28Registering a Mongo instance using Java based metadata ................................. 28Registering a Mongo instance using XML based metadata .................................. 29The MongoDbFactory interface ......................................................................... 30Registering a MongoDbFactory instance using Java based metadata ................... 31Registering a MongoDbFactory instance using XML based metadata ................... 325.4. Introduction to MongoTemplate .......................................................................... 33. Instantiating MongoTemplate ......................................................................... 34WriteResultChecking Policy ....................................................................... 351.4.0.BUILD-SNAPSHOTSpring Data MongoDB -Reference Documentationii

please define productname in your docbook file!WriteConcern ........................................................................................... 35WriteConcernResolver .............................................................................. 355.5. Saving, Updating, and Removing Documents ...................................................... 36How the '_id' field is handled in the mapping layer .............................................. 38Type mapping .................................................................................................. 39Methods for saving and inserting documents ...................................................... 40Which collection will my documents be saved into? .................................... 41Inserting or saving individual objects ......................................................... 41Inserting several objects in a batch ........................................................... 42Updating documents in a collection ................................................................... 42Methods for executing updates for documents ............................................ 42Methods for the Update class ................................................................... 42Upserting documents in a collection .................................................................. 43Finding and Upserting documents in a collection ................................................ 43Methods for removing documents ...................................................................... 445.6. Querying Documents ......................................................................................... 44Querying documents in a collection ................................................................... 45Methods for the Criteria class ................................................................... 45Methods for the Query class ..................................................................... 46Methods for querying for documents .................................................................. 47GeoSpatial Queries .......................................................................................... 47Geo near queries ..................................................................................... 495.7. Map-Reduce Operations .................................................................................... 49Example Usage ................................................................................................ 505.8. Group Operations .............................................................................................. 51Example Usage ................................................................................................ 525.9. Aggregation Framework Support ........................................................................ 53Basic Concepts ................................................................................................ 54Supported Aggregation Operations .................................................................... 54Projection Expressions ..................................................................................... 55Spring Expresison Support in Projection Expressions ................................. 55Aggregation Framework Examples .................................................................... 565.10. Overriding default mapping with custom converters ............................................ 61Saving using a registered Spring Converter ....................................................... 61Reading using a Spring Converter ..................................................................... 62Registering Spring Converters with the MongoConverter ..................................... 62Converter disambiguation ................................................................................. 635.11. Index and Collection managment ...................................................................... 63Methods for creating an Index ........................................................................... 63Accessing index information .............................................................................. 64Methods for working with a Collection ............................................................... 645.12. Executing Commands ...................................................................................... 64Methods for executing commands ..................................................................... 645.13. Lifecycle Events ............................................................................................... 655.14. Exception Translation ....................................................................................... 665.15. Execution callbacks ......................................................................................... 665.16. GridFS support ................................................................................................ 676. MongoDB repositories .................................................................................................. 706.1. Introduction ....................................................................................................... 706.2. Usage ............................................................................................................... 701.4.0.BUILD-SNAPSHOTSpring Data MongoDB -Reference Documentationiii

please define productname in your docbook file!Table of ContentsPreface ...................................................................................................................................... vI. Introduction ............................................................................................................................. 11. Why <strong>Spring</strong> <strong>Data</strong> - Document? ....................................................................................... 22. Requirements ................................................................................................................. 33. Additional Help Resources .............................................................................................. 43.1. Support ............................................................................................................... 4Community Forum .............................................................................................. 4Professional Support .......................................................................................... 43.2. Following Development ........................................................................................ 44. Working with <strong>Spring</strong> <strong>Data</strong> Repositories ............................................................................ 54.1. Core concepts ..................................................................................................... 54.2. Query methods ................................................................................................... 6Defining repository interfaces .............................................................................. 7Fine-tuning repository definition ................................................................... 7Defining query methods ...................................................................................... 7Query lookup strategies .............................................................................. 8Query creation ........................................................................................... 8Property expressions .................................................................................. 9Special parameter handling ........................................................................ 9Creating repository instances ............................................................................ 10XML configuration .................................................................................... 10JavaConfig ............................................................................................... 11Standalone usage .................................................................................... 114.3. Custom implementations for <strong>Spring</strong> <strong>Data</strong> repositories ........................................... 11Adding custom behavior to single repositories .................................................... 12Adding custom behavior to all repositories ......................................................... 134.4. <strong>Spring</strong> <strong>Data</strong> extensions ...................................................................................... 15<strong>Web</strong> support .................................................................................................... 15Basic web support .................................................................................... 15Hypermedia support for Pageables ............................................................ 17Repository populators ....................................................................................... 18Legacy web support ......................................................................................... 19Domain class web binding for <strong>Spring</strong> MVC ................................................ 19<strong>Web</strong> pagination ........................................................................................ 21II. Reference Documentation ..................................................................................................... 245. <strong>MongoDB</strong> support ........................................................................................................ 255.1. Getting Started .................................................................................................. 255.2. Examples Repository ......................................................................................... 285.3. Connecting to <strong>MongoDB</strong> with <strong>Spring</strong> .................................................................. 28Registering a Mongo instance using Java based metadata ................................. 28Registering a Mongo instance using XML based metadata .................................. 29The MongoDbFactory interface ......................................................................... 30Registering a MongoDbFactory instance using Java based metadata ................... 31Registering a MongoDbFactory instance using XML based metadata ................... 325.4. Introduction to MongoTemplate .......................................................................... 33. Instantiating MongoTemplate ......................................................................... 34WriteResultChecking Policy ....................................................................... 351.4.0.BUILD-SNAPSHOT<strong>Spring</strong> <strong>Data</strong> <strong>MongoDB</strong> -Reference Documentationii

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!