Interface SessionCallback<T>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Callback interface for executing operations within a
ClientSession
.- Since:
- 2.1
- Author:
- Christoph Strobl
- See Also:
-
ClientSession
-
Method Summary
Modifier and TypeMethodDescriptiondoInSession
(MongoOperations operations) Execute operations against a MongoDB instance via session boundMongoOperations
.
-
Method Details
-
doInSession
Execute operations against a MongoDB instance via session boundMongoOperations
. The session is inferred directly into the operation so that no further interaction is necessary.
Please note that only Spring Data-specific abstractions likeMongoOperations.find(Query, Class)
and others are enhanced with theClientSession
. When obtaining plain MongoDB gateway objects likeMongoCollection
orMongoDatabase
via eg.MongoOperations.getCollection(String)
we leave responsibility forClientSession
again up to the caller.- Parameters:
operations
- will never be null.- Returns:
- can be null.
-