SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Más contenido relacionado

Was ist angesagt?

PHPからJavaへ乗り換えた。そんな昔話をしよう
PHPからJavaへ乗り換えた。そんな昔話をしようPHPからJavaへ乗り換えた。そんな昔話をしよう
PHPからJavaへ乗り換えた。そんな昔話をしよう優介 黒河
 
マルチテナント化で知っておきたいデータベースのこと
マルチテナント化で知っておきたいデータベースのことマルチテナント化で知っておきたいデータベースのこと
マルチテナント化で知っておきたいデータベースのことAmazon Web Services Japan
 
CQRS and Event Sourcing for Java Developers
CQRS and Event Sourcing for Java DevelopersCQRS and Event Sourcing for Java Developers
CQRS and Event Sourcing for Java DevelopersMarkus Eisele
 
Building a World in the Clouds: MMO Architecture on AWS (MBL304) | AWS re:Inv...
Building a World in the Clouds: MMO Architecture on AWS (MBL304) | AWS re:Inv...Building a World in the Clouds: MMO Architecture on AWS (MBL304) | AWS re:Inv...
Building a World in the Clouds: MMO Architecture on AWS (MBL304) | AWS re:Inv...Amazon Web Services
 
最適なOpenJDKディストリビューションの選び方 #codetokyo19B3 #ccc_l5
最適なOpenJDKディストリビューションの選び方 #codetokyo19B3 #ccc_l5最適なOpenJDKディストリビューションの選び方 #codetokyo19B3 #ccc_l5
最適なOpenJDKディストリビューションの選び方 #codetokyo19B3 #ccc_l5Takahiro YAMADA
 
もしOracleDBAがMySQLを管理することになったときの注意点など
もしOracleDBAがMySQLを管理することになったときの注意点などもしOracleDBAがMySQLを管理することになったときの注意点など
もしOracleDBAがMySQLを管理することになったときの注意点などKentaro Kitagawa
 
S04 企業内システムと Microsoft Azure の VPN 接続、ファイルサーバー連携
S04 企業内システムと Microsoft Azure の VPN 接続、ファイルサーバー連携S04 企業内システムと Microsoft Azure の VPN 接続、ファイルサーバー連携
S04 企業内システムと Microsoft Azure の VPN 接続、ファイルサーバー連携Microsoft Azure Japan
 
Spring Framework Petclinic sample application
Spring Framework Petclinic sample applicationSpring Framework Petclinic sample application
Spring Framework Petclinic sample applicationAntoine Rey
 
今からでも遅くないDBマイグレーション - Flyway と SchemaSpy の紹介 -
今からでも遅くないDBマイグレーション - Flyway と SchemaSpy の紹介 -今からでも遅くないDBマイグレーション - Flyway と SchemaSpy の紹介 -
今からでも遅くないDBマイグレーション - Flyway と SchemaSpy の紹介 -onozaty
 
Azure Appservice WebAppsでWordPressサイトを構築すると 運用が劇的にラクになる話
Azure Appservice WebAppsでWordPressサイトを構築すると運用が劇的にラクになる話Azure Appservice WebAppsでWordPressサイトを構築すると運用が劇的にラクになる話
Azure Appservice WebAppsでWordPressサイトを構築すると 運用が劇的にラクになる話典子 松本
 
Developers Summit 2023 9-D-1「もう悩まされない開発環境、プロジェクトで統一した環境をいつでもどこでも」
Developers Summit 2023 9-D-1「もう悩まされない開発環境、プロジェクトで統一した環境をいつでもどこでも」Developers Summit 2023 9-D-1「もう悩まされない開発環境、プロジェクトで統一した環境をいつでもどこでも」
Developers Summit 2023 9-D-1「もう悩まされない開発環境、プロジェクトで統一した環境をいつでもどこでも」Kazumi IWANAGA
 
Dockerからcontainerdへの移行
Dockerからcontainerdへの移行Dockerからcontainerdへの移行
Dockerからcontainerdへの移行Akihiro Suda
 
Nest.js Introduction
Nest.js IntroductionNest.js Introduction
Nest.js IntroductionTakuya Tejima
 
Spring Boot in Action
Spring Boot in Action Spring Boot in Action
Spring Boot in Action Alex Movila
 
Laravel の paginate は一体何をやっているのか
Laravel の paginate は一体何をやっているのかLaravel の paginate は一体何をやっているのか
Laravel の paginate は一体何をやっているのかShohei Okada
 
ClassLoader Leak Patterns
ClassLoader Leak PatternsClassLoader Leak Patterns
ClassLoader Leak Patternsnekop
 
OOP 설계 원칙 S.O.L.I.D.
OOP 설계 원칙 S.O.L.I.D.OOP 설계 원칙 S.O.L.I.D.
OOP 설계 원칙 S.O.L.I.D.Ryan Park
 

Was ist angesagt? (20)

Rest ful api設計入門
Rest ful api設計入門Rest ful api設計入門
Rest ful api設計入門
 
PHPからJavaへ乗り換えた。そんな昔話をしよう
PHPからJavaへ乗り換えた。そんな昔話をしようPHPからJavaへ乗り換えた。そんな昔話をしよう
PHPからJavaへ乗り換えた。そんな昔話をしよう
 
マルチテナント化で知っておきたいデータベースのこと
マルチテナント化で知っておきたいデータベースのことマルチテナント化で知っておきたいデータベースのこと
マルチテナント化で知っておきたいデータベースのこと
 
CQRS and Event Sourcing for Java Developers
CQRS and Event Sourcing for Java DevelopersCQRS and Event Sourcing for Java Developers
CQRS and Event Sourcing for Java Developers
 
Building a World in the Clouds: MMO Architecture on AWS (MBL304) | AWS re:Inv...
Building a World in the Clouds: MMO Architecture on AWS (MBL304) | AWS re:Inv...Building a World in the Clouds: MMO Architecture on AWS (MBL304) | AWS re:Inv...
Building a World in the Clouds: MMO Architecture on AWS (MBL304) | AWS re:Inv...
 
最適なOpenJDKディストリビューションの選び方 #codetokyo19B3 #ccc_l5
最適なOpenJDKディストリビューションの選び方 #codetokyo19B3 #ccc_l5最適なOpenJDKディストリビューションの選び方 #codetokyo19B3 #ccc_l5
最適なOpenJDKディストリビューションの選び方 #codetokyo19B3 #ccc_l5
 
もしOracleDBAがMySQLを管理することになったときの注意点など
もしOracleDBAがMySQLを管理することになったときの注意点などもしOracleDBAがMySQLを管理することになったときの注意点など
もしOracleDBAがMySQLを管理することになったときの注意点など
 
S04 企業内システムと Microsoft Azure の VPN 接続、ファイルサーバー連携
S04 企業内システムと Microsoft Azure の VPN 接続、ファイルサーバー連携S04 企業内システムと Microsoft Azure の VPN 接続、ファイルサーバー連携
S04 企業内システムと Microsoft Azure の VPN 接続、ファイルサーバー連携
 
Spring Framework Petclinic sample application
Spring Framework Petclinic sample applicationSpring Framework Petclinic sample application
Spring Framework Petclinic sample application
 
今からでも遅くないDBマイグレーション - Flyway と SchemaSpy の紹介 -
今からでも遅くないDBマイグレーション - Flyway と SchemaSpy の紹介 -今からでも遅くないDBマイグレーション - Flyway と SchemaSpy の紹介 -
今からでも遅くないDBマイグレーション - Flyway と SchemaSpy の紹介 -
 
Azure Appservice WebAppsでWordPressサイトを構築すると 運用が劇的にラクになる話
Azure Appservice WebAppsでWordPressサイトを構築すると運用が劇的にラクになる話Azure Appservice WebAppsでWordPressサイトを構築すると運用が劇的にラクになる話
Azure Appservice WebAppsでWordPressサイトを構築すると 運用が劇的にラクになる話
 
Developers Summit 2023 9-D-1「もう悩まされない開発環境、プロジェクトで統一した環境をいつでもどこでも」
Developers Summit 2023 9-D-1「もう悩まされない開発環境、プロジェクトで統一した環境をいつでもどこでも」Developers Summit 2023 9-D-1「もう悩まされない開発環境、プロジェクトで統一した環境をいつでもどこでも」
Developers Summit 2023 9-D-1「もう悩まされない開発環境、プロジェクトで統一した環境をいつでもどこでも」
 
Dockerからcontainerdへの移行
Dockerからcontainerdへの移行Dockerからcontainerdへの移行
Dockerからcontainerdへの移行
 
Nest.js Introduction
Nest.js IntroductionNest.js Introduction
Nest.js Introduction
 
Spring Boot in Action
Spring Boot in Action Spring Boot in Action
Spring Boot in Action
 
Laravel の paginate は一体何をやっているのか
Laravel の paginate は一体何をやっているのかLaravel の paginate は一体何をやっているのか
Laravel の paginate は一体何をやっているのか
 
PHP MVC
PHP MVCPHP MVC
PHP MVC
 
ClassLoader Leak Patterns
ClassLoader Leak PatternsClassLoader Leak Patterns
ClassLoader Leak Patterns
 
OOP 설계 원칙 S.O.L.I.D.
OOP 설계 원칙 S.O.L.I.D.OOP 설계 원칙 S.O.L.I.D.
OOP 설계 원칙 S.O.L.I.D.
 
Introduction To Docker
Introduction To  DockerIntroduction To  Docker
Introduction To Docker
 

Andere mochten auch

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
 

Andere mochten auch (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Último

SIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENT
SIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENTSIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENT
SIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENTxtailishbaloch
 
UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3DianaGray10
 
Flow Control | Block Size | ST Min | First Frame
Flow Control | Block Size | ST Min | First FrameFlow Control | Block Size | ST Min | First Frame
Flow Control | Block Size | ST Min | First FrameKapil Thakar
 
Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.IPLOOK Networks
 
3 Pitfalls Everyone Should Avoid with Cloud Data
3 Pitfalls Everyone Should Avoid with Cloud Data3 Pitfalls Everyone Should Avoid with Cloud Data
3 Pitfalls Everyone Should Avoid with Cloud DataEric D. Schabell
 
.NET 8 ChatBot with Azure OpenAI Services.pptx
.NET 8 ChatBot with Azure OpenAI Services.pptx.NET 8 ChatBot with Azure OpenAI Services.pptx
.NET 8 ChatBot with Azure OpenAI Services.pptxHansamali Gamage
 
How to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptxHow to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptxKaustubhBhavsar6
 
2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdf2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdfThe Good Food Institute
 
Patch notes explaining DISARM Version 1.4 update
Patch notes explaining DISARM Version 1.4 updatePatch notes explaining DISARM Version 1.4 update
Patch notes explaining DISARM Version 1.4 updateadam112203
 
LF Energy Webinar - Unveiling OpenEEMeter 4.0
LF Energy Webinar - Unveiling OpenEEMeter 4.0LF Energy Webinar - Unveiling OpenEEMeter 4.0
LF Energy Webinar - Unveiling OpenEEMeter 4.0DanBrown980551
 
Stobox 4: Revolutionizing Investment in Real-World Assets Through Tokenization
Stobox 4: Revolutionizing Investment in Real-World Assets Through TokenizationStobox 4: Revolutionizing Investment in Real-World Assets Through Tokenization
Stobox 4: Revolutionizing Investment in Real-World Assets Through TokenizationStobox
 
Trailblazer Community - Flows Workshop (Session 2)
Trailblazer Community - Flows Workshop (Session 2)Trailblazer Community - Flows Workshop (Session 2)
Trailblazer Community - Flows Workshop (Session 2)Muhammad Tiham Siddiqui
 
March Patch Tuesday
March Patch TuesdayMarch Patch Tuesday
March Patch TuesdayIvanti
 
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024Alkin Tezuysal
 
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptxEmil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptxNeo4j
 
Graphene Quantum Dots-Based Composites for Biomedical Applications
Graphene Quantum Dots-Based Composites for  Biomedical ApplicationsGraphene Quantum Dots-Based Composites for  Biomedical Applications
Graphene Quantum Dots-Based Composites for Biomedical Applicationsnooralam814309
 
Where developers are challenged, what developers want and where DevEx is going
Where developers are challenged, what developers want and where DevEx is goingWhere developers are challenged, what developers want and where DevEx is going
Where developers are challenged, what developers want and where DevEx is goingFrancesco Corti
 
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedInOutage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedInThousandEyes
 
Scenario Library et REX Discover industry- and role- based scenarios
Scenario Library et REX Discover industry- and role- based scenariosScenario Library et REX Discover industry- and role- based scenarios
Scenario Library et REX Discover industry- and role- based scenariosErol GIRAUDY
 

Último (20)

SIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENT
SIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENTSIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENT
SIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENT
 
UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3
 
Flow Control | Block Size | ST Min | First Frame
Flow Control | Block Size | ST Min | First FrameFlow Control | Block Size | ST Min | First Frame
Flow Control | Block Size | ST Min | First Frame
 
Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.
 
3 Pitfalls Everyone Should Avoid with Cloud Data
3 Pitfalls Everyone Should Avoid with Cloud Data3 Pitfalls Everyone Should Avoid with Cloud Data
3 Pitfalls Everyone Should Avoid with Cloud Data
 
.NET 8 ChatBot with Azure OpenAI Services.pptx
.NET 8 ChatBot with Azure OpenAI Services.pptx.NET 8 ChatBot with Azure OpenAI Services.pptx
.NET 8 ChatBot with Azure OpenAI Services.pptx
 
How to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptxHow to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptx
 
2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdf2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdf
 
Patch notes explaining DISARM Version 1.4 update
Patch notes explaining DISARM Version 1.4 updatePatch notes explaining DISARM Version 1.4 update
Patch notes explaining DISARM Version 1.4 update
 
LF Energy Webinar - Unveiling OpenEEMeter 4.0
LF Energy Webinar - Unveiling OpenEEMeter 4.0LF Energy Webinar - Unveiling OpenEEMeter 4.0
LF Energy Webinar - Unveiling OpenEEMeter 4.0
 
Stobox 4: Revolutionizing Investment in Real-World Assets Through Tokenization
Stobox 4: Revolutionizing Investment in Real-World Assets Through TokenizationStobox 4: Revolutionizing Investment in Real-World Assets Through Tokenization
Stobox 4: Revolutionizing Investment in Real-World Assets Through Tokenization
 
Trailblazer Community - Flows Workshop (Session 2)
Trailblazer Community - Flows Workshop (Session 2)Trailblazer Community - Flows Workshop (Session 2)
Trailblazer Community - Flows Workshop (Session 2)
 
March Patch Tuesday
March Patch TuesdayMarch Patch Tuesday
March Patch Tuesday
 
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
Design and Modeling for MySQL SCALE 21X Pasadena, CA Mar 2024
 
SheDev 2024
SheDev 2024SheDev 2024
SheDev 2024
 
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptxEmil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
 
Graphene Quantum Dots-Based Composites for Biomedical Applications
Graphene Quantum Dots-Based Composites for  Biomedical ApplicationsGraphene Quantum Dots-Based Composites for  Biomedical Applications
Graphene Quantum Dots-Based Composites for Biomedical Applications
 
Where developers are challenged, what developers want and where DevEx is going
Where developers are challenged, what developers want and where DevEx is goingWhere developers are challenged, what developers want and where DevEx is going
Where developers are challenged, what developers want and where DevEx is going
 
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedInOutage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
 
Scenario Library et REX Discover industry- and role- based scenarios
Scenario Library et REX Discover industry- and role- based scenariosScenario Library et REX Discover industry- and role- based scenarios
Scenario Library et REX Discover industry- and role- based scenarios
 

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