For the latest stable version, please use Spring Data MongoDB 4.4.0!

MongoDB Support

Spring Data support for MongoDB contains a wide range of features:

For most tasks, you should use MongoTemplate or the Repository support, which both leverage the rich mapping functionality. MongoTemplate is the place to look for accessing functionality such as incrementing counters or ad-hoc CRUD operations. MongoTemplate also provides callback methods so that it is easy for you to get the low-level API artifacts, such as com.mongodb.client.MongoDatabase, to communicate directly with MongoDB. The goal with naming conventions on various API artifacts is to copy those in the base MongoDB Java driver so you can easily map your existing knowledge onto the Spring APIs.