SlideShare a Scribd company logo
1 of 26
MongoDB + JAVA + Spring data
Anton Sulzhenko
Java Software Engineer
Anton_Sulzhenko@epam.com
MongoDB + Java + Spring Data
  MongoDB


  Java


  Spring Data
3
         MongoDB           Java       Spring Data

What is NoSQL?
• Non-relational data
• Schemaless
• No JOINs, No complex transactions
• Horizontal scalability
4
        MongoDB           Java       Spring Data



• Key-value(Redis, MemcaheDB)
• Wide column(BigTable, Cassandra, HBase)
• Document(MongoDB, CouchDB, Riak)
• Graph(Neo4j, FlockDB)
5
MongoDB   Java   Spring Data
MongoDB
Documented-oriented database
7
             MongoDB          Java          Spring Data

 MongoDB Terminology
RDBMS                            Mongo DB
Database                         Database

Table                            Collection

Row                              JSON document

Column                           Field

Index                            Index

Join                             Embedded documents & linking

Aggregation (e.g. group by)      Aggregation framework
8
         MongoDB                 Java      Spring Data

MongoDB Features
• JSON data model with dynamic schemas
• CRUD operations
• Atomic document operations
• Ad hoq Queries like SQL (equality, regexp, ranges, geospatial)
• Full, flexible index support
• Auto-sharding for horizontal scalability
• Built-in replication and high availability
9
         MongoDB             Java        Spring Data

MongoDB Drivers
• One wire protocol for all client languages
• A driver implementation per language
• Responsibilities:
 - Converting language dependent data structures <-> BSON
 - Generating ObjectId for _id field
10




MongoDB + Java + Spring Data
  MongoDB


  Java


  Spring Data
11
           MongoDB           Java      Spring Data

MongoDB Java Driver Features
• CRUD
• Support for replica sets
• Connection pooling
• Distributed reads to slave servers
• BSON serializerdesirializer
• JSON serializerdesirializer
• GridFS
12
    MongoDB    Java   Spring Data

MongoDB Java Driver Usage
13




MongoDB + Java + Spring Data
  MongoDB


  Java


  Spring Data
SPRING DATA
MongoDB
15
           MongoDB                 Java          Spring Data

Spring Data MongoDB
• Templating
   • Resource abstraction
   • Configure connections to mongod/mongos node(s)
   • Collection lifecycle (create/drop)
   • Map/Reduce / Aggregation

• Object mapping
  • Annotation based: @Document, @Field, @Index etc.
  • Classes are mapped to collections, Java Objects to documents

• Repository Support
  • Queries are derived from method signatures
  • Geospatial Queries
16
               MongoDB                Java              Spring Data


Instantiating MongoTemplate using XML based metadata:
17
              MongoDB               Java      Spring Data


Sample CRUD operations using MongoTemplate:
18
        MongoDB           Java   Spring Data



 Mapping annotation overview:
• @Id
• @Document
• @DBRef
• @Indexed
• @CompoundIndex
• @GeoSpatialIndexed
• @Transient
• @PersistenceConstructor
• @Value
19
MongoDB   Java   Spring Data
20
           MongoDB                Java          Spring Data

Spring Data MongoDB: Repositories
• Main concept:
  • Use the signature of a method to derive the query(at runtime)
• Base implementations / abstractions for
  • CRUD operations
  • Paging
  • Sorting
21
      MongoDB     Java    Spring Data

Spring Data MongoDB: Repositories
22
                 MongoDB                 Java             Spring Data

  Spring Data MongoDB: Repositories
 Supported keywords for query methods:
                     Keyword                                          Logical result
GreaterThan                                 {"age" : {"$gt" : age}}
LessThan                                    {"age" : {"$lt" : age}}
Between                                     {"age" : {"$gt" : from, "$lt" : to}}
IsNotNull, NotNull                          {"age" : {"$ne" : null}}
IsNull, Null                                {"age" : null}
Like                                        {"age" : age} ( age as regex)
(No keyword)                                {"age" : name}
Not                                         {"age" : {"$ne" : name}}
Near                                        {"location" : {"$near" : [x,y]}}
Within                                      {"location" : {"$within" : {"$center" : [ [x, y], distance]}}}
Within                                      {"location" : {"$within" : {"$box" : [ [x1, y1], x2, y2]}}}
23
      MongoDB     Java    Spring Data

Spring Data MongoDB: Repositories
24
         MongoDB               Java    Spring Data




• Map/Reduce / Aggregation framework
• Index management
• Support for GridFS
• Geospatial indexes/queries
• Optimistic Locking
25
           MongoDB                  Java   Spring Data




• 10gen Education
   • https://education.10gen.com/
• Spring Data - MongoDB
  • http://www.springsource.org/spring-data/mongodb
• The Little MongoDB Book
  • http://openmymind.net/2011/3/28/The-Little-MongoDB-Book/
26




   Questions?
       MongoDB


       Java


       Spring Data


Anton Sulzhenko      Anton_Sulzhenko@epam.com

More Related Content

What's hot

Monitoring using Prometheus and Grafana
Monitoring using Prometheus and GrafanaMonitoring using Prometheus and Grafana
Monitoring using Prometheus and GrafanaArvind Kumar G.S
 
Wireshark Traffic Analysis
Wireshark Traffic AnalysisWireshark Traffic Analysis
Wireshark Traffic AnalysisDavid Sweigert
 
Microservices Tracing With Spring Cloud and Zipkin @Szczecin JUG
Microservices Tracing With Spring Cloud and Zipkin @Szczecin JUGMicroservices Tracing With Spring Cloud and Zipkin @Szczecin JUG
Microservices Tracing With Spring Cloud and Zipkin @Szczecin JUGMarcin Grzejszczak
 
The Data Lake Engine Data Microservices in Spark using Apache Arrow Flight
The Data Lake Engine Data Microservices in Spark using Apache Arrow FlightThe Data Lake Engine Data Microservices in Spark using Apache Arrow Flight
The Data Lake Engine Data Microservices in Spark using Apache Arrow FlightDatabricks
 
Spring Boot on Amazon Web Services with Spring Cloud AWS
Spring Boot on Amazon Web Services with Spring Cloud AWSSpring Boot on Amazon Web Services with Spring Cloud AWS
Spring Boot on Amazon Web Services with Spring Cloud AWSVMware Tanzu
 
Messaging with Spring Integration
Messaging with Spring IntegrationMessaging with Spring Integration
Messaging with Spring IntegrationVadim Mikhnevych
 
Docker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker, Inc.
 
Kubernetes Architecture with Components
 Kubernetes Architecture with Components Kubernetes Architecture with Components
Kubernetes Architecture with ComponentsAjeet Singh
 
Spring Cloud Function: Where We Were, Where We Are, and Where We’re Going
Spring Cloud Function: Where We Were, Where We Are, and Where We’re GoingSpring Cloud Function: Where We Were, Where We Are, and Where We’re Going
Spring Cloud Function: Where We Were, Where We Are, and Where We’re GoingVMware Tanzu
 
Spring Framework - AOP
Spring Framework - AOPSpring Framework - AOP
Spring Framework - AOPDzmitry Naskou
 
Event Sourcing & CQRS, Kafka, Rabbit MQ
Event Sourcing & CQRS, Kafka, Rabbit MQEvent Sourcing & CQRS, Kafka, Rabbit MQ
Event Sourcing & CQRS, Kafka, Rabbit MQAraf Karsh Hamid
 
WebLogic Scripting Tool made Cool!
WebLogic Scripting Tool made Cool!WebLogic Scripting Tool made Cool!
WebLogic Scripting Tool made Cool!Maarten Smeets
 
Kubernetes presentation
Kubernetes presentationKubernetes presentation
Kubernetes presentationGauranG Bajpai
 
Monitoring Your AWS EKS Environment with Datadog
Monitoring Your AWS EKS Environment with DatadogMonitoring Your AWS EKS Environment with Datadog
Monitoring Your AWS EKS Environment with DatadogDevOps.com
 

What's hot (20)

Snort
SnortSnort
Snort
 
Monitoring using Prometheus and Grafana
Monitoring using Prometheus and GrafanaMonitoring using Prometheus and Grafana
Monitoring using Prometheus and Grafana
 
Wireshark Traffic Analysis
Wireshark Traffic AnalysisWireshark Traffic Analysis
Wireshark Traffic Analysis
 
Spring Security 5
Spring Security 5Spring Security 5
Spring Security 5
 
Introduction to Apache Synapse
Introduction to Apache SynapseIntroduction to Apache Synapse
Introduction to Apache Synapse
 
Microservices Tracing With Spring Cloud and Zipkin @Szczecin JUG
Microservices Tracing With Spring Cloud and Zipkin @Szczecin JUGMicroservices Tracing With Spring Cloud and Zipkin @Szczecin JUG
Microservices Tracing With Spring Cloud and Zipkin @Szczecin JUG
 
Spring boot
Spring bootSpring boot
Spring boot
 
The Data Lake Engine Data Microservices in Spark using Apache Arrow Flight
The Data Lake Engine Data Microservices in Spark using Apache Arrow FlightThe Data Lake Engine Data Microservices in Spark using Apache Arrow Flight
The Data Lake Engine Data Microservices in Spark using Apache Arrow Flight
 
Spring Boot on Amazon Web Services with Spring Cloud AWS
Spring Boot on Amazon Web Services with Spring Cloud AWSSpring Boot on Amazon Web Services with Spring Cloud AWS
Spring Boot on Amazon Web Services with Spring Cloud AWS
 
Messaging with Spring Integration
Messaging with Spring IntegrationMessaging with Spring Integration
Messaging with Spring Integration
 
Docker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker 101: Introduction to Docker
Docker 101: Introduction to Docker
 
NMAP
NMAPNMAP
NMAP
 
Kubernetes Architecture with Components
 Kubernetes Architecture with Components Kubernetes Architecture with Components
Kubernetes Architecture with Components
 
Spring Cloud Function: Where We Were, Where We Are, and Where We’re Going
Spring Cloud Function: Where We Were, Where We Are, and Where We’re GoingSpring Cloud Function: Where We Were, Where We Are, and Where We’re Going
Spring Cloud Function: Where We Were, Where We Are, and Where We’re Going
 
Apache tomcat
Apache tomcatApache tomcat
Apache tomcat
 
Spring Framework - AOP
Spring Framework - AOPSpring Framework - AOP
Spring Framework - AOP
 
Event Sourcing & CQRS, Kafka, Rabbit MQ
Event Sourcing & CQRS, Kafka, Rabbit MQEvent Sourcing & CQRS, Kafka, Rabbit MQ
Event Sourcing & CQRS, Kafka, Rabbit MQ
 
WebLogic Scripting Tool made Cool!
WebLogic Scripting Tool made Cool!WebLogic Scripting Tool made Cool!
WebLogic Scripting Tool made Cool!
 
Kubernetes presentation
Kubernetes presentationKubernetes presentation
Kubernetes presentation
 
Monitoring Your AWS EKS Environment with Datadog
Monitoring Your AWS EKS Environment with DatadogMonitoring Your AWS EKS Environment with Datadog
Monitoring Your AWS EKS Environment with Datadog
 

Viewers also liked

Java Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBJava Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBMongoDB
 
MongoDB + Java - Everything you need to know
MongoDB + Java - Everything you need to know MongoDB + Java - Everything you need to know
MongoDB + Java - Everything you need to know Norberto Leite
 
Buenas prácticas para pequeños/medianos operadores de telefonía basados en Op...
Buenas prácticas para pequeños/medianos operadores de telefonía basados en Op...Buenas prácticas para pequeños/medianos operadores de telefonía basados en Op...
Buenas prácticas para pequeños/medianos operadores de telefonía basados en Op...PaloSanto Solutions
 
The Spring Data MongoDB Project
The Spring Data MongoDB ProjectThe Spring Data MongoDB Project
The Spring Data MongoDB ProjectMongoDB
 
Spring Data y Mongo DB en un proyecto Real
Spring Data y Mongo DB en un proyecto RealSpring Data y Mongo DB en un proyecto Real
Spring Data y Mongo DB en un proyecto RealDavid Gómez García
 
Reactive Access to MongoDB from Java 8
Reactive Access to MongoDB from Java 8Reactive Access to MongoDB from Java 8
Reactive Access to MongoDB from Java 8Hermann Hueck
 
Spring + JPA + DAO Step by Step
Spring + JPA + DAO Step by StepSpring + JPA + DAO Step by Step
Spring + JPA + DAO Step by StepGuo Albert
 
Hadoop, the Apple of Our Eyes (這些年,我們一起追的 Hadoop)
Hadoop, the Apple of Our Eyes (這些年,我們一起追的 Hadoop)Hadoop, the Apple of Our Eyes (這些年,我們一起追的 Hadoop)
Hadoop, the Apple of Our Eyes (這些年,我們一起追的 Hadoop)Kuo-Chun Su
 
Spring Data, Jongo & Co.
Spring Data, Jongo & Co.Spring Data, Jongo & Co.
Spring Data, Jongo & Co.Tobias Trelle
 
Morphia, Spring Data & Co.
Morphia, Spring Data & Co.Morphia, Spring Data & Co.
Morphia, Spring Data & Co.Tobias Trelle
 
Tests & recette - Les fondamentaux
Tests & recette - Les fondamentauxTests & recette - Les fondamentaux
Tests & recette - Les fondamentauxCOMPETENSIS
 
Présentation Agile Testing
Présentation Agile TestingPrésentation Agile Testing
Présentation Agile Testingjubehr
 

Viewers also liked (14)

Java Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBJava Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDB
 
MongoDB + Java - Everything you need to know
MongoDB + Java - Everything you need to know MongoDB + Java - Everything you need to know
MongoDB + Java - Everything you need to know
 
Buenas prácticas para pequeños/medianos operadores de telefonía basados en Op...
Buenas prácticas para pequeños/medianos operadores de telefonía basados en Op...Buenas prácticas para pequeños/medianos operadores de telefonía basados en Op...
Buenas prácticas para pequeños/medianos operadores de telefonía basados en Op...
 
MongoDB + Spring
MongoDB + SpringMongoDB + Spring
MongoDB + Spring
 
The Spring Data MongoDB Project
The Spring Data MongoDB ProjectThe Spring Data MongoDB Project
The Spring Data MongoDB Project
 
Spring Data y Mongo DB en un proyecto Real
Spring Data y Mongo DB en un proyecto RealSpring Data y Mongo DB en un proyecto Real
Spring Data y Mongo DB en un proyecto Real
 
Reactive Access to MongoDB from Java 8
Reactive Access to MongoDB from Java 8Reactive Access to MongoDB from Java 8
Reactive Access to MongoDB from Java 8
 
Spring + JPA + DAO Step by Step
Spring + JPA + DAO Step by StepSpring + JPA + DAO Step by Step
Spring + JPA + DAO Step by Step
 
Génie Logiciel : les tests
Génie Logiciel : les testsGénie Logiciel : les tests
Génie Logiciel : les tests
 
Hadoop, the Apple of Our Eyes (這些年,我們一起追的 Hadoop)
Hadoop, the Apple of Our Eyes (這些年,我們一起追的 Hadoop)Hadoop, the Apple of Our Eyes (這些年,我們一起追的 Hadoop)
Hadoop, the Apple of Our Eyes (這些年,我們一起追的 Hadoop)
 
Spring Data, Jongo & Co.
Spring Data, Jongo & Co.Spring Data, Jongo & Co.
Spring Data, Jongo & Co.
 
Morphia, Spring Data & Co.
Morphia, Spring Data & Co.Morphia, Spring Data & Co.
Morphia, Spring Data & Co.
 
Tests & recette - Les fondamentaux
Tests & recette - Les fondamentauxTests & recette - Les fondamentaux
Tests & recette - Les fondamentaux
 
Présentation Agile Testing
Présentation Agile TestingPrésentation Agile Testing
Présentation Agile Testing
 

Similar to MongoDB + Java + Spring Data

using Spring and MongoDB on Cloud Foundry
using Spring and MongoDB on Cloud Foundryusing Spring and MongoDB on Cloud Foundry
using Spring and MongoDB on Cloud FoundryJoshua Long
 
BedCon 2013 - Java Persistenz-Frameworks für MongoDB
BedCon 2013 - Java Persistenz-Frameworks für MongoDBBedCon 2013 - Java Persistenz-Frameworks für MongoDB
BedCon 2013 - Java Persistenz-Frameworks für MongoDBTobias Trelle
 
Mongodb
MongodbMongodb
Mongodbfoliba
 
Scalany mongodb aug10
Scalany mongodb aug10Scalany mongodb aug10
Scalany mongodb aug10bwmcadams
 
2016 feb-23 pyugre-py_mongo
2016 feb-23 pyugre-py_mongo2016 feb-23 pyugre-py_mongo
2016 feb-23 pyugre-py_mongoMichael Bright
 
Using MongoDB and Python
Using MongoDB and PythonUsing MongoDB and Python
Using MongoDB and PythonMike Bright
 
Copy of MongoDB .pptx
Copy of MongoDB .pptxCopy of MongoDB .pptx
Copy of MongoDB .pptxnehabsairam
 
MongoDB Tick Data Presentation
MongoDB Tick Data PresentationMongoDB Tick Data Presentation
MongoDB Tick Data PresentationMongoDB
 
10gen MongoDB Video Presentation at WebGeek DevCup
10gen MongoDB Video Presentation at WebGeek DevCup10gen MongoDB Video Presentation at WebGeek DevCup
10gen MongoDB Video Presentation at WebGeek DevCupWebGeek Philippines
 
Java Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBJava Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBTobias Trelle
 
Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)Chris Richardson
 
Using MongoDB For BigData in 20 Minutes
Using MongoDB For BigData in 20 MinutesUsing MongoDB For BigData in 20 Minutes
Using MongoDB For BigData in 20 MinutesAndrás Fehér
 
MongoDB in FS
MongoDB in FSMongoDB in FS
MongoDB in FSMongoDB
 
Basics of MongoDB
Basics of MongoDB Basics of MongoDB
Basics of MongoDB Habilelabs
 
MongoDB and Hadoop: Driving Business Insights
MongoDB and Hadoop: Driving Business InsightsMongoDB and Hadoop: Driving Business Insights
MongoDB and Hadoop: Driving Business InsightsMongoDB
 
Data Access 2.0? Please welcome, Spring Data!
Data Access 2.0? Please welcome, Spring Data!Data Access 2.0? Please welcome, Spring Data!
Data Access 2.0? Please welcome, Spring Data!Oliver Gierke
 
Spring Day | Data Access 2.0? Please Welcome Spring Data! | Oliver Gierke
Spring Day | Data Access 2.0? Please Welcome Spring Data! | Oliver GierkeSpring Day | Data Access 2.0? Please Welcome Spring Data! | Oliver Gierke
Spring Day | Data Access 2.0? Please Welcome Spring Data! | Oliver GierkeJAX London
 
MongoDB NoSQL database a deep dive -MyWhitePaper
MongoDB  NoSQL database a deep dive -MyWhitePaperMongoDB  NoSQL database a deep dive -MyWhitePaper
MongoDB NoSQL database a deep dive -MyWhitePaperRajesh Kumar
 

Similar to MongoDB + Java + Spring Data (20)

using Spring and MongoDB on Cloud Foundry
using Spring and MongoDB on Cloud Foundryusing Spring and MongoDB on Cloud Foundry
using Spring and MongoDB on Cloud Foundry
 
BedCon 2013 - Java Persistenz-Frameworks für MongoDB
BedCon 2013 - Java Persistenz-Frameworks für MongoDBBedCon 2013 - Java Persistenz-Frameworks für MongoDB
BedCon 2013 - Java Persistenz-Frameworks für MongoDB
 
Mongodb
MongodbMongodb
Mongodb
 
Scalany mongodb aug10
Scalany mongodb aug10Scalany mongodb aug10
Scalany mongodb aug10
 
2016 feb-23 pyugre-py_mongo
2016 feb-23 pyugre-py_mongo2016 feb-23 pyugre-py_mongo
2016 feb-23 pyugre-py_mongo
 
Using MongoDB and Python
Using MongoDB and PythonUsing MongoDB and Python
Using MongoDB and Python
 
Copy of MongoDB .pptx
Copy of MongoDB .pptxCopy of MongoDB .pptx
Copy of MongoDB .pptx
 
MongoDB Tick Data Presentation
MongoDB Tick Data PresentationMongoDB Tick Data Presentation
MongoDB Tick Data Presentation
 
10gen MongoDB Video Presentation at WebGeek DevCup
10gen MongoDB Video Presentation at WebGeek DevCup10gen MongoDB Video Presentation at WebGeek DevCup
10gen MongoDB Video Presentation at WebGeek DevCup
 
Java Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBJava Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDB
 
Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)
 
MongoDB
MongoDBMongoDB
MongoDB
 
Using MongoDB For BigData in 20 Minutes
Using MongoDB For BigData in 20 MinutesUsing MongoDB For BigData in 20 Minutes
Using MongoDB For BigData in 20 Minutes
 
MongoDB in FS
MongoDB in FSMongoDB in FS
MongoDB in FS
 
Basics of MongoDB
Basics of MongoDB Basics of MongoDB
Basics of MongoDB
 
MongoDB and Hadoop: Driving Business Insights
MongoDB and Hadoop: Driving Business InsightsMongoDB and Hadoop: Driving Business Insights
MongoDB and Hadoop: Driving Business Insights
 
Data Access 2.0? Please welcome, Spring Data!
Data Access 2.0? Please welcome, Spring Data!Data Access 2.0? Please welcome, Spring Data!
Data Access 2.0? Please welcome, Spring Data!
 
Spring Day | Data Access 2.0? Please Welcome Spring Data! | Oliver Gierke
Spring Day | Data Access 2.0? Please Welcome Spring Data! | Oliver GierkeSpring Day | Data Access 2.0? Please Welcome Spring Data! | Oliver Gierke
Spring Day | Data Access 2.0? Please Welcome Spring Data! | Oliver Gierke
 
MongoDB NoSQL database a deep dive -MyWhitePaper
MongoDB  NoSQL database a deep dive -MyWhitePaperMongoDB  NoSQL database a deep dive -MyWhitePaper
MongoDB NoSQL database a deep dive -MyWhitePaper
 
mongodb_DS.pptx
mongodb_DS.pptxmongodb_DS.pptx
mongodb_DS.pptx
 

Recently uploaded

Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 

Recently uploaded (20)

Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 

MongoDB + Java + Spring Data

  • 1. MongoDB + JAVA + Spring data Anton Sulzhenko Java Software Engineer Anton_Sulzhenko@epam.com
  • 2. MongoDB + Java + Spring Data MongoDB Java Spring Data
  • 3. 3 MongoDB Java Spring Data What is NoSQL? • Non-relational data • Schemaless • No JOINs, No complex transactions • Horizontal scalability
  • 4. 4 MongoDB Java Spring Data • Key-value(Redis, MemcaheDB) • Wide column(BigTable, Cassandra, HBase) • Document(MongoDB, CouchDB, Riak) • Graph(Neo4j, FlockDB)
  • 5. 5 MongoDB Java Spring Data
  • 7. 7 MongoDB Java Spring Data MongoDB Terminology RDBMS Mongo DB Database Database Table Collection Row JSON document Column Field Index Index Join Embedded documents & linking Aggregation (e.g. group by) Aggregation framework
  • 8. 8 MongoDB Java Spring Data MongoDB Features • JSON data model with dynamic schemas • CRUD operations • Atomic document operations • Ad hoq Queries like SQL (equality, regexp, ranges, geospatial) • Full, flexible index support • Auto-sharding for horizontal scalability • Built-in replication and high availability
  • 9. 9 MongoDB Java Spring Data MongoDB Drivers • One wire protocol for all client languages • A driver implementation per language • Responsibilities: - Converting language dependent data structures <-> BSON - Generating ObjectId for _id field
  • 10. 10 MongoDB + Java + Spring Data MongoDB Java Spring Data
  • 11. 11 MongoDB Java Spring Data MongoDB Java Driver Features • CRUD • Support for replica sets • Connection pooling • Distributed reads to slave servers • BSON serializerdesirializer • JSON serializerdesirializer • GridFS
  • 12. 12 MongoDB Java Spring Data MongoDB Java Driver Usage
  • 13. 13 MongoDB + Java + Spring Data MongoDB Java Spring Data
  • 15. 15 MongoDB Java Spring Data Spring Data MongoDB • Templating • Resource abstraction • Configure connections to mongod/mongos node(s) • Collection lifecycle (create/drop) • Map/Reduce / Aggregation • Object mapping • Annotation based: @Document, @Field, @Index etc. • Classes are mapped to collections, Java Objects to documents • Repository Support • Queries are derived from method signatures • Geospatial Queries
  • 16. 16 MongoDB Java Spring Data Instantiating MongoTemplate using XML based metadata:
  • 17. 17 MongoDB Java Spring Data Sample CRUD operations using MongoTemplate:
  • 18. 18 MongoDB Java Spring Data Mapping annotation overview: • @Id • @Document • @DBRef • @Indexed • @CompoundIndex • @GeoSpatialIndexed • @Transient • @PersistenceConstructor • @Value
  • 19. 19 MongoDB Java Spring Data
  • 20. 20 MongoDB Java Spring Data Spring Data MongoDB: Repositories • Main concept: • Use the signature of a method to derive the query(at runtime) • Base implementations / abstractions for • CRUD operations • Paging • Sorting
  • 21. 21 MongoDB Java Spring Data Spring Data MongoDB: Repositories
  • 22. 22 MongoDB Java Spring Data Spring Data MongoDB: Repositories Supported keywords for query methods: Keyword Logical result GreaterThan {"age" : {"$gt" : age}} LessThan {"age" : {"$lt" : age}} Between {"age" : {"$gt" : from, "$lt" : to}} IsNotNull, NotNull {"age" : {"$ne" : null}} IsNull, Null {"age" : null} Like {"age" : age} ( age as regex) (No keyword) {"age" : name} Not {"age" : {"$ne" : name}} Near {"location" : {"$near" : [x,y]}} Within {"location" : {"$within" : {"$center" : [ [x, y], distance]}}} Within {"location" : {"$within" : {"$box" : [ [x1, y1], x2, y2]}}}
  • 23. 23 MongoDB Java Spring Data Spring Data MongoDB: Repositories
  • 24. 24 MongoDB Java Spring Data • Map/Reduce / Aggregation framework • Index management • Support for GridFS • Geospatial indexes/queries • Optimistic Locking
  • 25. 25 MongoDB Java Spring Data • 10gen Education • https://education.10gen.com/ • Spring Data - MongoDB • http://www.springsource.org/spring-data/mongodb • The Little MongoDB Book • http://openmymind.net/2011/3/28/The-Little-MongoDB-Book/
  • 26. 26 Questions? MongoDB Java Spring Data Anton Sulzhenko Anton_Sulzhenko@epam.com