SlideShare a Scribd company logo
September, 2020
What’s new in Spring Data
MongoDB
Copyright © 2020 VMware, Inc. or its affiliates.
Before We Start
Staying focused is hard :)
📨 📲 ☕
Documentation
Samples
...
🎬
🎥 🎧
Cover w/ Image
Agenda
● Newman Release (May 2020)
● 2020.0 (expected end Oct 2020)
codename Ockham
org.springframework.data
spring-data-releasetrain
Neumann-SR3
CUR
org.springframework.data
spring-data-bom
2020.0.0-M2
PRE
org.springframework.data
spring-data-mongodb
3.1.0-M2
PRE
Spring Data MongoDB 3.0 (Neumann)
Major version upgrade with some breaking changes
● Driver upgrades to 4.0
● Indexing Updates
● Updates via Aggregation pipeline
● Reactive GridFS changes
● Convenience
org.springframework.data
spring-data-mongodb
3.0.3
CUR
org.mongodb
mongodb-driver-reactivestreams
1.12.0
3.0 – Driver Upgrades
Dependency Changes
org.mongodb
mongo-java-driver
3.11.2
2.x
mongo-java-driver
sync
mongo-java-driver ...-driver-reactivestreams
reactive
org.mongodb
mongodb-driver-reactivestreams
4.0.5
org.mongodb
mongodb-driver-reactivestreams
1.12.0
3.0 – Driver Upgrades
Dependency Changes
org.mongodb
mongo-java-driver
3.11.2
org.mongodb
mongodb-driver-sync
4.0.5
org.mongodb
mongodb-driver-core
4.0.5
mongo-java-driver
mongo-java-driver ...-driver-reactivestreams
2.x 3.0
sync
reactive
mongodb-driver-core
mongodb-driver-sync
sync
mongodb-driver-reactivestreams
mongodb-driver-core
reactive
3.0 – Driver Upgrades
Configuration Changes – What it was like in 2.x
AbstractMongoConfiguration (2.x)
@Configuration
class Cfg extends AbstractMongoConfiguration {
@Override
protected String getDatabaseName() {
return "database";
}
@Override
public com.mongodb.MongoClient mongoClient() {
return new com.mongodb.MongoClient();
}
}
3.0 – Driver Upgrades
Configuration Changes – Driver Type
AbstractMongoClientConfiguration (3.x)
@Configuration
class Cfg extends AbstractMongoConfiguration {
@Override
protected String getDatabaseName() {
return "database";
}
@Override
public com.mongodb.MongoClient mongoClient() {
return new com.mongodb.MongoClient();
}
}
@Configuration
class Cfg extends AbstractMongoClientConfiguration {
@Override
protected String getDatabaseName() {
return "database";
}
@Override
public com.mongodb.client.MongoClient mongoClient() {
return MongoClients.create();
}
}
AbstractMongoConfiguration (2.x)
@Configuration
class Cfg extends AbstractMongoConfiguration {
@Override
protected String getDatabaseName() {
return "database";
}
@Override
public com.mongodb.MongoClient mongoClient() {
return new com.mongodb.MongoClient();
}
}
AbstractMongoConfiguration (2.x)
3.0 – Driver Upgrades
Configuration Changes – Client Creation
AbstractMongoClientConfiguration (3.x)
@Configuration
class Cfg extends AbstractMongoClientConfiguration {
@Override
protected String getDatabaseName() {
return "database";
}
}
3.0 – Driver Upgrades
Configuration Changes – Driver Settings
AbstractMongoClientConfiguration (3.x)
@Configuration
class Cfg extends AbstractMongoConfiguration {
@Override
protected String getDatabaseName() {
return "database";
}
@Override
public com.mongodb.MongoClient mongoClient() {
MongoClientURI uri = new MongoClientURI("!!...
return new MongoClient(uri));
}
}
@Configuration
class Cfg extends AbstractMongoClientConfiguration {
@Override
protected String getDatabaseName() {
return "database";
}
@Override
protected void configureClientSettings(Builder builder) {
builder.applyConnectionString(new ConnectionString("...
builder.uuidRepresentation(UuidRepresentation.STANDARD);
}
}
AbstractMongoConfiguration (2.x)
AbstractMongoClientConfiguration (3.x)
@Configuration
class Cfg extends AbstractMongoClientConfiguration {
@Override
protected String getDatabaseName() {
return "database";
}
@Override
protected void configureClientSettings(Builder builder) {
builder.applyConnectionString(new ConnectionString("!!..."));
builder.uuidRepresentation(UuidRepresentation.STANDARD);
}
@Override
protected boolean autoIndexCreation() {
return true;
}
}
3.0 – Driver Upgrades
Configuration Changes - Indexing
AbstractMongoConfiguration (2.x)
@Document
public class Person {
@Id private String id;
@Indexed(unique = true) private Integer ssn;
private String firstName;
@Indexed private String lastName;
private Integer age;
}
{…}
spring.data.mongodb.auto-index-creation
3.0 – Update via Aggregation Pipeline
{…}
{
"_id" : 1,
"student" : "Maya",
"homework" : [ 10, 5, 10 ],
"quiz" : [ 10, 8 ],
"extraCredit" : 0
}
totalHomework : { $sum : $homework }
totalQuiz : { $sum : $quiz }
totalScore : {
$add : [
"$totalHomework",
"$totalQuiz",
"$extraCredit“ ]}
Expressive, Conditional Updates
$addFields
$set
$unset
$replaceWith
$replaceRoot
$project
3.0 – Update via Aggregation Pipeline
{…}
{
"_id" : 1,
"student" : "Maya",
"homework" : [ 10, 5, 10 ],
"quiz" : [ 10, 8 ],
"extraCredit" : 0
}
totalHomework : { $sum : $homework }
totalQuiz : { $sum : $quiz }
totalScore : {
$add : [
"$totalHomework",
"$totalQuiz",
"$extraCredit“ ]}
public void calculateTotalScore() {
AggregationUpdate update = AggregationUpdate.update()
.set(SetOperation.builder()
.set("totalHomework").toValueOf(valueOf("homework").sum())
.and()
.set("totalQuiz").toValueOf(valueOf("quiz").sum())
.and()
.set("totalScore").toValueOf(
valueOf("totalHomework")
.add("totalQuiz")
.add("extraCredit ")));
mongoOperations.update(Student.class)
.apply(update)
.all();
}
Expressive, Conditional Updates
3.0 – Reactive GridFS
AsyncInputStream source = AsyncStreamHelper.toAsyncInputStream(resource.getInputStream());
gridFSops.store(source, “springone", "binary/octet-stream", metadata);
2.x
3.0 – Reactive GridFS
Flux<DataBuffer> source = ...
gridFSops.store(source, “springone", "binary/octet-stream", metadata);
public class ReactiveGridFsResource {
public Mono<GridFSFile> getGridFSFile() {
!!...
}
}
public Flux<DataBuffer> getContent() {
... // via GridFSDownloadPublisher
}
ReactiveGridFsResource s1p = gridFSops.getResources("s1p");
3.0
3.0 – Convenience
...somtimes it’s the small things
query(where("name")...)
.withHint(
new Document("att1", 1).append("att2", 1)
)
@Sharded
public class Person {
private @Id String id;
private String firstname;
}
Shard Support
template.query(Person.class)
.matching(where("firstname").is("luke"))
.one()
Narrow API
query(where("name")!!...).withHint("index-name")
Index Hints (via name)
template.query(Person.class)
.matching(query(where("firstname").is("luke")))
.one()
Spring Data MongoDB 3.1 (2020.0)
Closing gaps to the imperative implementation.
● Reactive SpEL in @Query annotations
● Reactive Auditing
● Repository Metrics
● GraalVM Native Image experience
● Read Only Transactions
codename: Ockham
The following section is intended to outline the general direction
of VMware's offerings. It is intended for information purposes
only and may not be incorporated into any contract. Any
information regarding pre-release of VMware offerings, future
updates or other planned modifications is subject to ongoing
evaluation by VMware and is subject to change. This information
is provided without warranty or any kind, express or implied, and
is not a commitment to deliver any material, code, or
functionality, and should not be relied upon in making
purchasing decisions regarding VMware's offerings. These
purchasing decisions should only be based on features currently
available. The development, release, and timing of any features
or functionality described for VMware's offerings in this
presentation remain at the sole discretion of VMware. VMware
has no obligation to update forward looking information in this
presentation.
org.springframework.data
spring-data-mongodb
3.1.0-M2
PRE
@Query("{ 'supervisor' : ?#{ hasRole('ROLE_ADMIN') ? new Document('$regex', '*') : principal.name } }")
Flux<Person> findAllFilteredByRole();
3.1 – Reactive SpEL
now truly reactive via ReactiveEvaluationContextExtension
Flux<Person> all = repo.findAllFilteredByRole();
all.subscribe();
2.x
⚡
3.1
👍
3.1 – Reactive Auditing
@CreatedBy, @CreatedDate, @LastMod...
@Configuration
@EnableReactiveMongoAuditing
static class AuditingConfig extends AbstractReactiveMongoConfiguration {
@Override
protected String getDatabaseName() {
return "database";
}
@Bean
public ReactiveAuditorAware<User> auditorProvider() {
return () -> ReactiveSecurityContextHolder.getContext()
.map(it -> ...);
}
}
repo.save(fiona).subscribe();
3.1 – Repository Metrics
Execution Time Measurement
PersonRepository.save(Object):
2 ms – SUCCESS
Flux<Person> all = repo.findAll();
repo.save(frank).subscribe();
all.subscribe();
interface PersonRepository extends ReactiveCrudRepository<Person, String> {
Flux<Person> findByName(String name);
@Query("{ 'name' : { '$set' : 'Gallagher' } }")
Flux<Person> findError();
}
PersonRepository.save(Object):
2 ms - SUCCESS
PersonRepository.findAll():
32 ms – SUCCESS
repo.findByName("fiona").subscribe();
repo.findError().subscribe();
PersonRespository.findByName(String):
1 ms - SUCCESS
PersonRepository.findError():
20 ms - ERROR
3.1 – Repository Metrics Setup
via Invocation Listeners
@Bean
public RepositoryMetricsPostProcessor repositoryMetricsPostProcessor() {
return new RepositoryMetricsPostProcessor();
}
static class RepositoryMetricsPostProcessor implements BeanPostProcessor {
public Object postProcessBeforeInitialization(Object bean, String beanName) ...
if (bean instanceof RepositoryFactoryBeanSupport) {
RepositoryFactoryBeanSupport<?, ?, ?> repositoryFactoryBean = (...) bean;
repositoryFactoryBean
.addRepositoryFactoryCustomizer(repositoryFactory -> {
repositoryFactory.addInvocationListener(System.out::println);
});
}
return bean;
}
}
3.1 – GraalVM Native Image
...with spring-graalvm-native
SpringDataComponentProcessor
org.springframework.experimental
spring-graalvm-native
0.7.1
SpringDataMongoDBTypeHints
@Query
@Aggregation
@Document
@Indexed
@DBRef
Nested Types
Infrastructure Components ... extends CrudRepository<T, ID>
Signature Types
Methods
Custom Implementations
3.1 – GraalVM Native Image
...with spring-graalvm-native
© 2020 Spring. A VMware-backed project.
Thank you
Contact us @SpringData
Data
- Staying Ahead of the Curve with Spring and Cassandra 4
- The Past Year in Spring for Apache Geode
- A Deep Dive into Spring Application Events
- Full Steam Ahead, R2DBC!
- Building Flexible APIs with Spring HATEOAS
DAY1
DAY2
GraalVM
- Modernizing Apps for the Cloud with Spring
- The Path Towards Spring Boot Native Applications
- Spring Boot Revisited with KoFu and JaFu
DAY1
DAY2
Questions?
org.springframework.data
spring-data-mongodb
3.0.3
org.springframework.experimental
spring-graalvm-native
0.7.1
CUR
org.springframework.data
spring-data-mongodb
3.1.0-M2
PRE
PRE

More Related Content

What's hot

Introduction to MongoDB.pptx
Introduction to MongoDB.pptxIntroduction to MongoDB.pptx
Introduction to MongoDB.pptx
Surya937648
 
Reactive Programming In Java Using: Project Reactor
Reactive Programming In Java Using: Project ReactorReactive Programming In Java Using: Project Reactor
Reactive Programming In Java Using: Project Reactor
Knoldus Inc.
 
Cassandra Introduction & Features
Cassandra Introduction & FeaturesCassandra Introduction & Features
Cassandra Introduction & Features
DataStax Academy
 
Spring Framework - MVC
Spring Framework - MVCSpring Framework - MVC
Spring Framework - MVC
Dzmitry Naskou
 
Spring Security 5
Spring Security 5Spring Security 5
Spring Security 5
Jesus Perez Franco
 
An introduction to MongoDB
An introduction to MongoDBAn introduction to MongoDB
An introduction to MongoDB
César Trigo
 
Mongo db
Mongo dbMongo db
Mongo db
Gyanendra Yadav
 
On-boarding with JanusGraph Performance
On-boarding with JanusGraph PerformanceOn-boarding with JanusGraph Performance
On-boarding with JanusGraph Performance
Chin Huang
 
Spring framework
Spring frameworkSpring framework
Spring framework
Rajkumar Singh
 
MongoDB
MongoDBMongoDB
MongoDB
nikhil2807
 
Introduction à Angular 2
Introduction à Angular 2Introduction à Angular 2
Introduction à Angular 2
Laurent Duveau
 
서버학개론(백엔드 서버 개발자를 위한)
서버학개론(백엔드 서버 개발자를 위한)서버학개론(백엔드 서버 개발자를 위한)
서버학개론(백엔드 서버 개발자를 위한)
수보 김
 
MongoDB presentation
MongoDB presentationMongoDB presentation
MongoDB presentation
Hyphen Call
 
Spring boot introduction
Spring boot introductionSpring boot introduction
Spring boot introduction
Rasheed Waraich
 
Apache tomcat
Apache tomcatApache tomcat
Apache tomcat
Shashwat Shriparv
 
Laravel Tutorial PPT
Laravel Tutorial PPTLaravel Tutorial PPT
Laravel Tutorial PPT
Piyush Aggarwal
 
Spring framework Introduction
Spring framework IntroductionSpring framework Introduction
Spring framework Introduction
Anuj Singh Rajput
 
Mongodb basics and architecture
Mongodb basics and architectureMongodb basics and architecture
Mongodb basics and architecture
Bishal Khanal
 
Learning ASP.NET 5 and MVC 6
Learning ASP.NET 5 and MVC 6Learning ASP.NET 5 and MVC 6
Learning ASP.NET 5 and MVC 6
Ido Flatow
 
Introduction to Spring Boot!
Introduction to Spring Boot!Introduction to Spring Boot!
Introduction to Spring Boot!
Jakub Kubrynski
 

What's hot (20)

Introduction to MongoDB.pptx
Introduction to MongoDB.pptxIntroduction to MongoDB.pptx
Introduction to MongoDB.pptx
 
Reactive Programming In Java Using: Project Reactor
Reactive Programming In Java Using: Project ReactorReactive Programming In Java Using: Project Reactor
Reactive Programming In Java Using: Project Reactor
 
Cassandra Introduction & Features
Cassandra Introduction & FeaturesCassandra Introduction & Features
Cassandra Introduction & Features
 
Spring Framework - MVC
Spring Framework - MVCSpring Framework - MVC
Spring Framework - MVC
 
Spring Security 5
Spring Security 5Spring Security 5
Spring Security 5
 
An introduction to MongoDB
An introduction to MongoDBAn introduction to MongoDB
An introduction to MongoDB
 
Mongo db
Mongo dbMongo db
Mongo db
 
On-boarding with JanusGraph Performance
On-boarding with JanusGraph PerformanceOn-boarding with JanusGraph Performance
On-boarding with JanusGraph Performance
 
Spring framework
Spring frameworkSpring framework
Spring framework
 
MongoDB
MongoDBMongoDB
MongoDB
 
Introduction à Angular 2
Introduction à Angular 2Introduction à Angular 2
Introduction à Angular 2
 
서버학개론(백엔드 서버 개발자를 위한)
서버학개론(백엔드 서버 개발자를 위한)서버학개론(백엔드 서버 개발자를 위한)
서버학개론(백엔드 서버 개발자를 위한)
 
MongoDB presentation
MongoDB presentationMongoDB presentation
MongoDB presentation
 
Spring boot introduction
Spring boot introductionSpring boot introduction
Spring boot introduction
 
Apache tomcat
Apache tomcatApache tomcat
Apache tomcat
 
Laravel Tutorial PPT
Laravel Tutorial PPTLaravel Tutorial PPT
Laravel Tutorial PPT
 
Spring framework Introduction
Spring framework IntroductionSpring framework Introduction
Spring framework Introduction
 
Mongodb basics and architecture
Mongodb basics and architectureMongodb basics and architecture
Mongodb basics and architecture
 
Learning ASP.NET 5 and MVC 6
Learning ASP.NET 5 and MVC 6Learning ASP.NET 5 and MVC 6
Learning ASP.NET 5 and MVC 6
 
Introduction to Spring Boot!
Introduction to Spring Boot!Introduction to Spring Boot!
Introduction to Spring Boot!
 

Similar to What’s New in Spring Data MongoDB

Walking Through Spring Cloud Data Flow
Walking Through Spring Cloud Data FlowWalking Through Spring Cloud Data Flow
Walking Through Spring Cloud Data Flow
VMware Tanzu
 
PRG 420 Week 3 Individual Assignment Netbeans Project (annual co.docx
PRG 420 Week 3 Individual Assignment Netbeans Project (annual co.docxPRG 420 Week 3 Individual Assignment Netbeans Project (annual co.docx
PRG 420 Week 3 Individual Assignment Netbeans Project (annual co.docx
harrisonhoward80223
 
Evolution is Continuous, and so are Big Data and Streaming Pipelines
Evolution is Continuous, and so are Big Data and Streaming PipelinesEvolution is Continuous, and so are Big Data and Streaming Pipelines
Evolution is Continuous, and so are Big Data and Streaming Pipelines
Databricks
 
Droidcon Paris 2015
Droidcon Paris 2015Droidcon Paris 2015
Droidcon Paris 2015
Renaud Boulard
 
Azure from scratch part 4
Azure from scratch part 4Azure from scratch part 4
Azure from scratch part 4
Girish Kalamati
 
Dropwizard Introduction
Dropwizard IntroductionDropwizard Introduction
Dropwizard Introduction
Anthony Chen
 
How to Webpack your Django!
How to Webpack your Django!How to Webpack your Django!
How to Webpack your Django!
David Gibbons
 
Spring Performance Gains
Spring Performance GainsSpring Performance Gains
Spring Performance Gains
VMware Tanzu
 
What's Next Replay - SpringSource
What's Next Replay - SpringSourceWhat's Next Replay - SpringSource
What's Next Replay - SpringSource
ZenikaOuest
 
InterConnect2016: WebApp Architectures with Java and Node.js
InterConnect2016: WebApp Architectures with Java and Node.jsInterConnect2016: WebApp Architectures with Java and Node.js
InterConnect2016: WebApp Architectures with Java and Node.js
Chris Bailey
 
Simplify Cloud Applications using Spring Cloud
Simplify Cloud Applications using Spring CloudSimplify Cloud Applications using Spring Cloud
Simplify Cloud Applications using Spring Cloud
Ramnivas Laddad
 
Building and deploying React applications
Building and deploying React applicationsBuilding and deploying React applications
Building and deploying React applications
Astrails
 
using Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'susing Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API's
Antônio Roberto Silva
 
Infinum Android Talks #14 - Data binding to the rescue... or not (?) by Krist...
Infinum Android Talks #14 - Data binding to the rescue... or not (?) by Krist...Infinum Android Talks #14 - Data binding to the rescue... or not (?) by Krist...
Infinum Android Talks #14 - Data binding to the rescue... or not (?) by Krist...
Infinum
 
Google app engine by example
Google app engine by exampleGoogle app engine by example
Google app engine by example
Alexander Zamkovyi
 
Play vs Grails Smackdown - Devoxx France 2013
Play vs Grails Smackdown - Devoxx France 2013Play vs Grails Smackdown - Devoxx France 2013
Play vs Grails Smackdown - Devoxx France 2013
Matt Raible
 
Projeto-web-services-Spring-Boot-JPA.pdf
Projeto-web-services-Spring-Boot-JPA.pdfProjeto-web-services-Spring-Boot-JPA.pdf
Projeto-web-services-Spring-Boot-JPA.pdf
AdrianoSantos888423
 
Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)
Gunith Devasurendra
 
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdf
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdfdokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdf
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdf
Appster1
 
dokumen.tips_rediscovering-spring-with-spring-boot1.pdf
dokumen.tips_rediscovering-spring-with-spring-boot1.pdfdokumen.tips_rediscovering-spring-with-spring-boot1.pdf
dokumen.tips_rediscovering-spring-with-spring-boot1.pdf
Appster1
 

Similar to What’s New in Spring Data MongoDB (20)

Walking Through Spring Cloud Data Flow
Walking Through Spring Cloud Data FlowWalking Through Spring Cloud Data Flow
Walking Through Spring Cloud Data Flow
 
PRG 420 Week 3 Individual Assignment Netbeans Project (annual co.docx
PRG 420 Week 3 Individual Assignment Netbeans Project (annual co.docxPRG 420 Week 3 Individual Assignment Netbeans Project (annual co.docx
PRG 420 Week 3 Individual Assignment Netbeans Project (annual co.docx
 
Evolution is Continuous, and so are Big Data and Streaming Pipelines
Evolution is Continuous, and so are Big Data and Streaming PipelinesEvolution is Continuous, and so are Big Data and Streaming Pipelines
Evolution is Continuous, and so are Big Data and Streaming Pipelines
 
Droidcon Paris 2015
Droidcon Paris 2015Droidcon Paris 2015
Droidcon Paris 2015
 
Azure from scratch part 4
Azure from scratch part 4Azure from scratch part 4
Azure from scratch part 4
 
Dropwizard Introduction
Dropwizard IntroductionDropwizard Introduction
Dropwizard Introduction
 
How to Webpack your Django!
How to Webpack your Django!How to Webpack your Django!
How to Webpack your Django!
 
Spring Performance Gains
Spring Performance GainsSpring Performance Gains
Spring Performance Gains
 
What's Next Replay - SpringSource
What's Next Replay - SpringSourceWhat's Next Replay - SpringSource
What's Next Replay - SpringSource
 
InterConnect2016: WebApp Architectures with Java and Node.js
InterConnect2016: WebApp Architectures with Java and Node.jsInterConnect2016: WebApp Architectures with Java and Node.js
InterConnect2016: WebApp Architectures with Java and Node.js
 
Simplify Cloud Applications using Spring Cloud
Simplify Cloud Applications using Spring CloudSimplify Cloud Applications using Spring Cloud
Simplify Cloud Applications using Spring Cloud
 
Building and deploying React applications
Building and deploying React applicationsBuilding and deploying React applications
Building and deploying React applications
 
using Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API'susing Mithril.js + postgREST to build and consume API's
using Mithril.js + postgREST to build and consume API's
 
Infinum Android Talks #14 - Data binding to the rescue... or not (?) by Krist...
Infinum Android Talks #14 - Data binding to the rescue... or not (?) by Krist...Infinum Android Talks #14 - Data binding to the rescue... or not (?) by Krist...
Infinum Android Talks #14 - Data binding to the rescue... or not (?) by Krist...
 
Google app engine by example
Google app engine by exampleGoogle app engine by example
Google app engine by example
 
Play vs Grails Smackdown - Devoxx France 2013
Play vs Grails Smackdown - Devoxx France 2013Play vs Grails Smackdown - Devoxx France 2013
Play vs Grails Smackdown - Devoxx France 2013
 
Projeto-web-services-Spring-Boot-JPA.pdf
Projeto-web-services-Spring-Boot-JPA.pdfProjeto-web-services-Spring-Boot-JPA.pdf
Projeto-web-services-Spring-Boot-JPA.pdf
 
Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)
 
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdf
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdfdokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdf
dokumen.tips_rediscovering-spring-with-spring-boot1 (1).pdf
 
dokumen.tips_rediscovering-spring-with-spring-boot1.pdf
dokumen.tips_rediscovering-spring-with-spring-boot1.pdfdokumen.tips_rediscovering-spring-with-spring-boot1.pdf
dokumen.tips_rediscovering-spring-with-spring-boot1.pdf
 

More from VMware Tanzu

Spring into AI presented by Dan Vega 5/14
Spring into AI presented by Dan Vega 5/14Spring into AI presented by Dan Vega 5/14
Spring into AI presented by Dan Vega 5/14
VMware Tanzu
 
What AI Means For Your Product Strategy And What To Do About It
What AI Means For Your Product Strategy And What To Do About ItWhat AI Means For Your Product Strategy And What To Do About It
What AI Means For Your Product Strategy And What To Do About It
VMware Tanzu
 
Make the Right Thing the Obvious Thing at Cardinal Health 2023
Make the Right Thing the Obvious Thing at Cardinal Health 2023Make the Right Thing the Obvious Thing at Cardinal Health 2023
Make the Right Thing the Obvious Thing at Cardinal Health 2023
VMware Tanzu
 
Enhancing DevEx and Simplifying Operations at Scale
Enhancing DevEx and Simplifying Operations at ScaleEnhancing DevEx and Simplifying Operations at Scale
Enhancing DevEx and Simplifying Operations at Scale
VMware Tanzu
 
Spring Update | July 2023
Spring Update | July 2023Spring Update | July 2023
Spring Update | July 2023
VMware Tanzu
 
Platforms, Platform Engineering, & Platform as a Product
Platforms, Platform Engineering, & Platform as a ProductPlatforms, Platform Engineering, & Platform as a Product
Platforms, Platform Engineering, & Platform as a Product
VMware Tanzu
 
Building Cloud Ready Apps
Building Cloud Ready AppsBuilding Cloud Ready Apps
Building Cloud Ready Apps
VMware Tanzu
 
Spring Boot 3 And Beyond
Spring Boot 3 And BeyondSpring Boot 3 And Beyond
Spring Boot 3 And Beyond
VMware Tanzu
 
Spring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdf
Spring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdfSpring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdf
Spring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdf
VMware Tanzu
 
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
VMware Tanzu
 
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
VMware Tanzu
 
tanzu_developer_connect.pptx
tanzu_developer_connect.pptxtanzu_developer_connect.pptx
tanzu_developer_connect.pptx
VMware Tanzu
 
Tanzu Virtual Developer Connect Workshop - French
Tanzu Virtual Developer Connect Workshop - FrenchTanzu Virtual Developer Connect Workshop - French
Tanzu Virtual Developer Connect Workshop - French
VMware Tanzu
 
Tanzu Developer Connect Workshop - English
Tanzu Developer Connect Workshop - EnglishTanzu Developer Connect Workshop - English
Tanzu Developer Connect Workshop - English
VMware Tanzu
 
Virtual Developer Connect Workshop - English
Virtual Developer Connect Workshop - EnglishVirtual Developer Connect Workshop - English
Virtual Developer Connect Workshop - English
VMware Tanzu
 
Tanzu Developer Connect - French
Tanzu Developer Connect - FrenchTanzu Developer Connect - French
Tanzu Developer Connect - French
VMware Tanzu
 
Simplify and Scale Enterprise Apps in the Cloud | Dallas 2023
Simplify and Scale Enterprise Apps in the Cloud | Dallas 2023Simplify and Scale Enterprise Apps in the Cloud | Dallas 2023
Simplify and Scale Enterprise Apps in the Cloud | Dallas 2023
VMware Tanzu
 
SpringOne Tour: Deliver 15-Factor Applications on Kubernetes with Spring Boot
SpringOne Tour: Deliver 15-Factor Applications on Kubernetes with Spring BootSpringOne Tour: Deliver 15-Factor Applications on Kubernetes with Spring Boot
SpringOne Tour: Deliver 15-Factor Applications on Kubernetes with Spring Boot
VMware Tanzu
 
SpringOne Tour: The Influential Software Engineer
SpringOne Tour: The Influential Software EngineerSpringOne Tour: The Influential Software Engineer
SpringOne Tour: The Influential Software Engineer
VMware Tanzu
 
SpringOne Tour: Domain-Driven Design: Theory vs Practice
SpringOne Tour: Domain-Driven Design: Theory vs PracticeSpringOne Tour: Domain-Driven Design: Theory vs Practice
SpringOne Tour: Domain-Driven Design: Theory vs Practice
VMware Tanzu
 

More from VMware Tanzu (20)

Spring into AI presented by Dan Vega 5/14
Spring into AI presented by Dan Vega 5/14Spring into AI presented by Dan Vega 5/14
Spring into AI presented by Dan Vega 5/14
 
What AI Means For Your Product Strategy And What To Do About It
What AI Means For Your Product Strategy And What To Do About ItWhat AI Means For Your Product Strategy And What To Do About It
What AI Means For Your Product Strategy And What To Do About It
 
Make the Right Thing the Obvious Thing at Cardinal Health 2023
Make the Right Thing the Obvious Thing at Cardinal Health 2023Make the Right Thing the Obvious Thing at Cardinal Health 2023
Make the Right Thing the Obvious Thing at Cardinal Health 2023
 
Enhancing DevEx and Simplifying Operations at Scale
Enhancing DevEx and Simplifying Operations at ScaleEnhancing DevEx and Simplifying Operations at Scale
Enhancing DevEx and Simplifying Operations at Scale
 
Spring Update | July 2023
Spring Update | July 2023Spring Update | July 2023
Spring Update | July 2023
 
Platforms, Platform Engineering, & Platform as a Product
Platforms, Platform Engineering, & Platform as a ProductPlatforms, Platform Engineering, & Platform as a Product
Platforms, Platform Engineering, & Platform as a Product
 
Building Cloud Ready Apps
Building Cloud Ready AppsBuilding Cloud Ready Apps
Building Cloud Ready Apps
 
Spring Boot 3 And Beyond
Spring Boot 3 And BeyondSpring Boot 3 And Beyond
Spring Boot 3 And Beyond
 
Spring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdf
Spring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdfSpring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdf
Spring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdf
 
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
 
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
 
tanzu_developer_connect.pptx
tanzu_developer_connect.pptxtanzu_developer_connect.pptx
tanzu_developer_connect.pptx
 
Tanzu Virtual Developer Connect Workshop - French
Tanzu Virtual Developer Connect Workshop - FrenchTanzu Virtual Developer Connect Workshop - French
Tanzu Virtual Developer Connect Workshop - French
 
Tanzu Developer Connect Workshop - English
Tanzu Developer Connect Workshop - EnglishTanzu Developer Connect Workshop - English
Tanzu Developer Connect Workshop - English
 
Virtual Developer Connect Workshop - English
Virtual Developer Connect Workshop - EnglishVirtual Developer Connect Workshop - English
Virtual Developer Connect Workshop - English
 
Tanzu Developer Connect - French
Tanzu Developer Connect - FrenchTanzu Developer Connect - French
Tanzu Developer Connect - French
 
Simplify and Scale Enterprise Apps in the Cloud | Dallas 2023
Simplify and Scale Enterprise Apps in the Cloud | Dallas 2023Simplify and Scale Enterprise Apps in the Cloud | Dallas 2023
Simplify and Scale Enterprise Apps in the Cloud | Dallas 2023
 
SpringOne Tour: Deliver 15-Factor Applications on Kubernetes with Spring Boot
SpringOne Tour: Deliver 15-Factor Applications on Kubernetes with Spring BootSpringOne Tour: Deliver 15-Factor Applications on Kubernetes with Spring Boot
SpringOne Tour: Deliver 15-Factor Applications on Kubernetes with Spring Boot
 
SpringOne Tour: The Influential Software Engineer
SpringOne Tour: The Influential Software EngineerSpringOne Tour: The Influential Software Engineer
SpringOne Tour: The Influential Software Engineer
 
SpringOne Tour: Domain-Driven Design: Theory vs Practice
SpringOne Tour: Domain-Driven Design: Theory vs PracticeSpringOne Tour: Domain-Driven Design: Theory vs Practice
SpringOne Tour: Domain-Driven Design: Theory vs Practice
 

Recently uploaded

Going AOT: Everything you need to know about GraalVM for Java applications
Going AOT: Everything you need to know about GraalVM for Java applicationsGoing AOT: Everything you need to know about GraalVM for Java applications
Going AOT: Everything you need to know about GraalVM for Java applications
Alina Yurenko
 
Upturn India Technologies - Web development company in Nashik
Upturn India Technologies - Web development company in NashikUpturn India Technologies - Web development company in Nashik
Upturn India Technologies - Web development company in Nashik
Upturn India Technologies
 
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
gapen1
 
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptxMigration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
ervikas4
 
TMU毕业证书精仿办理
TMU毕业证书精仿办理TMU毕业证书精仿办理
TMU毕业证书精仿办理
aeeva
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
ToXSL Technologies
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
Alberto Brandolini
 
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdfBaha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid
 
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
kalichargn70th171
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
dakas1
 
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
widenerjobeyrl638
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and MoreManyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
narinav14
 
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdfThe Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
kalichargn70th171
 
ppt on the brain chip neuralink.pptx
ppt  on   the brain  chip neuralink.pptxppt  on   the brain  chip neuralink.pptx
ppt on the brain chip neuralink.pptx
Reetu63
 
The Role of DevOps in Digital Transformation.pdf
The Role of DevOps in Digital Transformation.pdfThe Role of DevOps in Digital Transformation.pdf
The Role of DevOps in Digital Transformation.pdf
mohitd6
 
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom KittEnhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Peter Caitens
 
Optimizing Your E-commerce with WooCommerce.pptx
Optimizing Your E-commerce with WooCommerce.pptxOptimizing Your E-commerce with WooCommerce.pptx
Optimizing Your E-commerce with WooCommerce.pptx
WebConnect Pvt Ltd
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
dakas1
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
Patrick Weigel
 

Recently uploaded (20)

Going AOT: Everything you need to know about GraalVM for Java applications
Going AOT: Everything you need to know about GraalVM for Java applicationsGoing AOT: Everything you need to know about GraalVM for Java applications
Going AOT: Everything you need to know about GraalVM for Java applications
 
Upturn India Technologies - Web development company in Nashik
Upturn India Technologies - Web development company in NashikUpturn India Technologies - Web development company in Nashik
Upturn India Technologies - Web development company in Nashik
 
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
如何办理(hull学位证书)英国赫尔大学毕业证硕士文凭原版一模一样
 
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptxMigration From CH 1.0 to CH 2.0 and  Mule 4.6 & Java 17 Upgrade.pptx
Migration From CH 1.0 to CH 2.0 and Mule 4.6 & Java 17 Upgrade.pptx
 
TMU毕业证书精仿办理
TMU毕业证书精仿办理TMU毕业证书精仿办理
TMU毕业证书精仿办理
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
 
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdfBaha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
 
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and MoreManyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
 
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdfThe Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
 
ppt on the brain chip neuralink.pptx
ppt  on   the brain  chip neuralink.pptxppt  on   the brain  chip neuralink.pptx
ppt on the brain chip neuralink.pptx
 
The Role of DevOps in Digital Transformation.pdf
The Role of DevOps in Digital Transformation.pdfThe Role of DevOps in Digital Transformation.pdf
The Role of DevOps in Digital Transformation.pdf
 
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom KittEnhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
 
Optimizing Your E-commerce with WooCommerce.pptx
Optimizing Your E-commerce with WooCommerce.pptxOptimizing Your E-commerce with WooCommerce.pptx
Optimizing Your E-commerce with WooCommerce.pptx
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
 

What’s New in Spring Data MongoDB

  • 1. September, 2020 What’s new in Spring Data MongoDB Copyright © 2020 VMware, Inc. or its affiliates.
  • 2. Before We Start Staying focused is hard :) 📨 📲 ☕ Documentation Samples ... 🎬 🎥 🎧
  • 3. Cover w/ Image Agenda ● Newman Release (May 2020) ● 2020.0 (expected end Oct 2020) codename Ockham org.springframework.data spring-data-releasetrain Neumann-SR3 CUR org.springframework.data spring-data-bom 2020.0.0-M2 PRE org.springframework.data spring-data-mongodb 3.1.0-M2 PRE
  • 4. Spring Data MongoDB 3.0 (Neumann) Major version upgrade with some breaking changes ● Driver upgrades to 4.0 ● Indexing Updates ● Updates via Aggregation pipeline ● Reactive GridFS changes ● Convenience org.springframework.data spring-data-mongodb 3.0.3 CUR
  • 5. org.mongodb mongodb-driver-reactivestreams 1.12.0 3.0 – Driver Upgrades Dependency Changes org.mongodb mongo-java-driver 3.11.2 2.x mongo-java-driver sync mongo-java-driver ...-driver-reactivestreams reactive
  • 6. org.mongodb mongodb-driver-reactivestreams 4.0.5 org.mongodb mongodb-driver-reactivestreams 1.12.0 3.0 – Driver Upgrades Dependency Changes org.mongodb mongo-java-driver 3.11.2 org.mongodb mongodb-driver-sync 4.0.5 org.mongodb mongodb-driver-core 4.0.5 mongo-java-driver mongo-java-driver ...-driver-reactivestreams 2.x 3.0 sync reactive mongodb-driver-core mongodb-driver-sync sync mongodb-driver-reactivestreams mongodb-driver-core reactive
  • 7. 3.0 – Driver Upgrades Configuration Changes – What it was like in 2.x AbstractMongoConfiguration (2.x) @Configuration class Cfg extends AbstractMongoConfiguration { @Override protected String getDatabaseName() { return "database"; } @Override public com.mongodb.MongoClient mongoClient() { return new com.mongodb.MongoClient(); } }
  • 8. 3.0 – Driver Upgrades Configuration Changes – Driver Type AbstractMongoClientConfiguration (3.x) @Configuration class Cfg extends AbstractMongoConfiguration { @Override protected String getDatabaseName() { return "database"; } @Override public com.mongodb.MongoClient mongoClient() { return new com.mongodb.MongoClient(); } } @Configuration class Cfg extends AbstractMongoClientConfiguration { @Override protected String getDatabaseName() { return "database"; } @Override public com.mongodb.client.MongoClient mongoClient() { return MongoClients.create(); } } AbstractMongoConfiguration (2.x)
  • 9. @Configuration class Cfg extends AbstractMongoConfiguration { @Override protected String getDatabaseName() { return "database"; } @Override public com.mongodb.MongoClient mongoClient() { return new com.mongodb.MongoClient(); } } AbstractMongoConfiguration (2.x) 3.0 – Driver Upgrades Configuration Changes – Client Creation AbstractMongoClientConfiguration (3.x) @Configuration class Cfg extends AbstractMongoClientConfiguration { @Override protected String getDatabaseName() { return "database"; } }
  • 10. 3.0 – Driver Upgrades Configuration Changes – Driver Settings AbstractMongoClientConfiguration (3.x) @Configuration class Cfg extends AbstractMongoConfiguration { @Override protected String getDatabaseName() { return "database"; } @Override public com.mongodb.MongoClient mongoClient() { MongoClientURI uri = new MongoClientURI("!!... return new MongoClient(uri)); } } @Configuration class Cfg extends AbstractMongoClientConfiguration { @Override protected String getDatabaseName() { return "database"; } @Override protected void configureClientSettings(Builder builder) { builder.applyConnectionString(new ConnectionString("... builder.uuidRepresentation(UuidRepresentation.STANDARD); } } AbstractMongoConfiguration (2.x)
  • 11. AbstractMongoClientConfiguration (3.x) @Configuration class Cfg extends AbstractMongoClientConfiguration { @Override protected String getDatabaseName() { return "database"; } @Override protected void configureClientSettings(Builder builder) { builder.applyConnectionString(new ConnectionString("!!...")); builder.uuidRepresentation(UuidRepresentation.STANDARD); } @Override protected boolean autoIndexCreation() { return true; } } 3.0 – Driver Upgrades Configuration Changes - Indexing AbstractMongoConfiguration (2.x) @Document public class Person { @Id private String id; @Indexed(unique = true) private Integer ssn; private String firstName; @Indexed private String lastName; private Integer age; } {…} spring.data.mongodb.auto-index-creation
  • 12. 3.0 – Update via Aggregation Pipeline {…} { "_id" : 1, "student" : "Maya", "homework" : [ 10, 5, 10 ], "quiz" : [ 10, 8 ], "extraCredit" : 0 } totalHomework : { $sum : $homework } totalQuiz : { $sum : $quiz } totalScore : { $add : [ "$totalHomework", "$totalQuiz", "$extraCredit“ ]} Expressive, Conditional Updates $addFields $set $unset $replaceWith $replaceRoot $project
  • 13. 3.0 – Update via Aggregation Pipeline {…} { "_id" : 1, "student" : "Maya", "homework" : [ 10, 5, 10 ], "quiz" : [ 10, 8 ], "extraCredit" : 0 } totalHomework : { $sum : $homework } totalQuiz : { $sum : $quiz } totalScore : { $add : [ "$totalHomework", "$totalQuiz", "$extraCredit“ ]} public void calculateTotalScore() { AggregationUpdate update = AggregationUpdate.update() .set(SetOperation.builder() .set("totalHomework").toValueOf(valueOf("homework").sum()) .and() .set("totalQuiz").toValueOf(valueOf("quiz").sum()) .and() .set("totalScore").toValueOf( valueOf("totalHomework") .add("totalQuiz") .add("extraCredit "))); mongoOperations.update(Student.class) .apply(update) .all(); } Expressive, Conditional Updates
  • 14. 3.0 – Reactive GridFS AsyncInputStream source = AsyncStreamHelper.toAsyncInputStream(resource.getInputStream()); gridFSops.store(source, “springone", "binary/octet-stream", metadata); 2.x
  • 15. 3.0 – Reactive GridFS Flux<DataBuffer> source = ... gridFSops.store(source, “springone", "binary/octet-stream", metadata); public class ReactiveGridFsResource { public Mono<GridFSFile> getGridFSFile() { !!... } } public Flux<DataBuffer> getContent() { ... // via GridFSDownloadPublisher } ReactiveGridFsResource s1p = gridFSops.getResources("s1p"); 3.0
  • 16. 3.0 – Convenience ...somtimes it’s the small things query(where("name")...) .withHint( new Document("att1", 1).append("att2", 1) ) @Sharded public class Person { private @Id String id; private String firstname; } Shard Support template.query(Person.class) .matching(where("firstname").is("luke")) .one() Narrow API query(where("name")!!...).withHint("index-name") Index Hints (via name) template.query(Person.class) .matching(query(where("firstname").is("luke"))) .one()
  • 17. Spring Data MongoDB 3.1 (2020.0) Closing gaps to the imperative implementation. ● Reactive SpEL in @Query annotations ● Reactive Auditing ● Repository Metrics ● GraalVM Native Image experience ● Read Only Transactions codename: Ockham The following section is intended to outline the general direction of VMware's offerings. It is intended for information purposes only and may not be incorporated into any contract. Any information regarding pre-release of VMware offerings, future updates or other planned modifications is subject to ongoing evaluation by VMware and is subject to change. This information is provided without warranty or any kind, express or implied, and is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions regarding VMware's offerings. These purchasing decisions should only be based on features currently available. The development, release, and timing of any features or functionality described for VMware's offerings in this presentation remain at the sole discretion of VMware. VMware has no obligation to update forward looking information in this presentation. org.springframework.data spring-data-mongodb 3.1.0-M2 PRE
  • 18. @Query("{ 'supervisor' : ?#{ hasRole('ROLE_ADMIN') ? new Document('$regex', '*') : principal.name } }") Flux<Person> findAllFilteredByRole(); 3.1 – Reactive SpEL now truly reactive via ReactiveEvaluationContextExtension Flux<Person> all = repo.findAllFilteredByRole(); all.subscribe(); 2.x ⚡ 3.1 👍
  • 19. 3.1 – Reactive Auditing @CreatedBy, @CreatedDate, @LastMod... @Configuration @EnableReactiveMongoAuditing static class AuditingConfig extends AbstractReactiveMongoConfiguration { @Override protected String getDatabaseName() { return "database"; } @Bean public ReactiveAuditorAware<User> auditorProvider() { return () -> ReactiveSecurityContextHolder.getContext() .map(it -> ...); } }
  • 20. repo.save(fiona).subscribe(); 3.1 – Repository Metrics Execution Time Measurement PersonRepository.save(Object): 2 ms – SUCCESS Flux<Person> all = repo.findAll(); repo.save(frank).subscribe(); all.subscribe(); interface PersonRepository extends ReactiveCrudRepository<Person, String> { Flux<Person> findByName(String name); @Query("{ 'name' : { '$set' : 'Gallagher' } }") Flux<Person> findError(); } PersonRepository.save(Object): 2 ms - SUCCESS PersonRepository.findAll(): 32 ms – SUCCESS repo.findByName("fiona").subscribe(); repo.findError().subscribe(); PersonRespository.findByName(String): 1 ms - SUCCESS PersonRepository.findError(): 20 ms - ERROR
  • 21. 3.1 – Repository Metrics Setup via Invocation Listeners @Bean public RepositoryMetricsPostProcessor repositoryMetricsPostProcessor() { return new RepositoryMetricsPostProcessor(); } static class RepositoryMetricsPostProcessor implements BeanPostProcessor { public Object postProcessBeforeInitialization(Object bean, String beanName) ... if (bean instanceof RepositoryFactoryBeanSupport) { RepositoryFactoryBeanSupport<?, ?, ?> repositoryFactoryBean = (...) bean; repositoryFactoryBean .addRepositoryFactoryCustomizer(repositoryFactory -> { repositoryFactory.addInvocationListener(System.out::println); }); } return bean; } }
  • 22. 3.1 – GraalVM Native Image ...with spring-graalvm-native SpringDataComponentProcessor org.springframework.experimental spring-graalvm-native 0.7.1 SpringDataMongoDBTypeHints @Query @Aggregation @Document @Indexed @DBRef Nested Types Infrastructure Components ... extends CrudRepository<T, ID> Signature Types Methods Custom Implementations
  • 23. 3.1 – GraalVM Native Image ...with spring-graalvm-native
  • 24. © 2020 Spring. A VMware-backed project. Thank you Contact us @SpringData Data - Staying Ahead of the Curve with Spring and Cassandra 4 - The Past Year in Spring for Apache Geode - A Deep Dive into Spring Application Events - Full Steam Ahead, R2DBC! - Building Flexible APIs with Spring HATEOAS DAY1 DAY2 GraalVM - Modernizing Apps for the Cloud with Spring - The Path Towards Spring Boot Native Applications - Spring Boot Revisited with KoFu and JaFu DAY1 DAY2