SlideShare una empresa de Scribd logo
1 de 16
Descargar para leer sin conexión
MongoDB with
Spring Data Document
      Sean@Weaveus
         May 2011
<<interface>>


                      @Autowired
                                    Mongo
                                   Operations

                         Bean
                                     Mongo
                                    Template


                         Bean
                                   MongoDB
                                    Driver




Monday, May 9, 2011                                 2
DB


                      Collection#1        Collection#2
                        Document#1          Document#1

                        Document#2          Document#2

                        Document#3          Document#3

                        Document#4          Document#4

                        Document#5          Document#5




                  Document := {UniqueID, JSON Document}

Monday, May 9, 2011                                       3
Getting Started - Server

   SeaniMac:tmp sean$ ls
   mongodb-osx-x86_64-1.8.1.tgz
   mongodb-osx-x86_64-1.8.1
   SeaniMac:tmp sean$ mkdir -p mongodb-data/db
   SeaniMac:tmp sean$ ./mongodb-osx-x86_64-1.8.1/bin/mongod --dbpath ./
   mongodb-data/db
   Fri May! 6 14:16:48 [initandlisten] MongoDB starting ...
   ...




Monday, May 9, 2011                                                       4
Getting Started - Client

   SeaniMac:tmp sean$ ./mongodb-osx-x86_64-1.8.1/bin/mongo
   MongoDB shell version: 1.8.1
   connecting to: test
   > db.foo.save( { a: 1 } )
   > db.foo.find()
   { "_id" : ObjectId("4dc3855d3044bae59620330d"), "a" : 1 }




Monday, May 9, 2011                                            5
Java(Groovy)
   import com.mongodb.Mongo
   import com.mongodb.DB
   import com.mongodb.DBCollection

   Mongo m = new Mongo()
   println m.databaseNames

   DB db = m.getDB("test")
   println db.collectionNames

   DBCollection dbcol = db.getCollection("foo")
   println dbcol.find().next() // DBObject Instance, BSON

   // results
   [test, admin, db, foo, local]
   [foo, system.indexes]
   [_id:4dc3855d3044bae59620330d, a:1.0]




Monday, May 9, 2011                                         6
Document CRUD



Monday, May 9, 2011                   7
Save


   >   db.things.save({ name: "mongo" })
   >   t = { x : 3 }
   {   "x" : 3 }
   >   db.things.save(t)




Monday, May 9, 2011                        8
Find
   >   db.things.find()
   {   "_id" : ObjectId("4dc399fc3044bae59620330e"), "name" : "mongo" }
   {   "_id" : ObjectId("4dc3a7913044bae59620330f"), "x" : 3 }
   >   var cursor = db.things.find();
   >   while (cursor.hasNext()) printjson(cursor.next());
   {   "_id" : ObjectId("4dc399fc3044bae59620330e"), "name" : "mongo" }
   {   "_id" : ObjectId("4dc3a7913044bae59620330f"), "x" : 3 }
   >   db.things.find().forEach( printjson )
   {   "_id" : ObjectId("4dc399fc3044bae59620330e"), "name" : "mongo" }
   {   "_id" : ObjectId("4dc3a7913044bae59620330f"), "x" : 3 }

   > db.things.find({name:"mongo"}).forEach( printjson );
   { "_id" : ObjectId("4dc399fc3044bae59620330e"), "name" : "mongo" }

   >   db.things.save( {"name":"nosql", "title":"nonRDB"} )
   >   db.things.find( {name:"nosql"}, {title:true} ).forEach
   (   printjson )
   {   "_id" : ObjectId("4dc3ae133044bae596203312"), "title" : "nonRDB" }



Monday, May 9, 2011                                                         9
Remove

   >   db.things.remove({name:"mongo"})
   >   db.things.remove({"_id":ObjectId("4dc3ae133044bae596203312")})
   >   db.things.find()!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   {   "_id" : ObjectId("4dc3a7913044bae59620330f"), "x" : 3 }




Monday, May 9, 2011                                                     10
with Spring Data



Monday, May 9, 2011                      11
MongoTemplate

                •     Document databases extension to Spring
                      Programming Model
                •     SPEL
                •     DataException hierarchy
                •     IoC Configuration



Monday, May 9, 2011                                            12
Beans @Configuration or XML-Based




Monday, May 9, 2011                                      13
<<interface>>

                                                     Mongo
                                    Mongo
                      @Autowired                    Repository
                                   Operations
                                                     Mongo
                                                     Criteria
                         Bean
                                     Mongo
                                    Template


                         Bean
                                   MongoDB
                                    Driver




Monday, May 9, 2011                                              14
Object-Document
                      Implicit Conversion




Monday, May 9, 2011                         15
•     MongoRepository

                      •   Method name based Query

                      •   @Query, QueryDSL

                      •   Criteria, Predication Support

                      •   GPS Query

                •     Mapping

                      •   @Document(Instead of @Entity)

                •     Asynchronous Callback



Monday, May 9, 2011                                       16

Más contenido relacionado

La actualidad más candente

A Day in the Life of a Druid Implementor and Druid's Roadmap
A Day in the Life of a Druid Implementor and Druid's RoadmapA Day in the Life of a Druid Implementor and Druid's Roadmap
A Day in the Life of a Druid Implementor and Druid's Roadmap
Itai Yaffe
 
AWS Customer Presentation: Freie Univerisitat - Berlin Summit 2012
AWS Customer Presentation: Freie Univerisitat - Berlin Summit 2012AWS Customer Presentation: Freie Univerisitat - Berlin Summit 2012
AWS Customer Presentation: Freie Univerisitat - Berlin Summit 2012
Amazon Web Services
 
The Real-time Web in the Age of Agents
The Real-time Web in the Age of AgentsThe Real-time Web in the Age of Agents
The Real-time Web in the Age of Agents
Joshua Shinavier
 

La actualidad más candente (20)

Data-Driven Development Era and Its Technologies
Data-Driven Development Era and Its TechnologiesData-Driven Development Era and Its Technologies
Data-Driven Development Era and Its Technologies
 
A Day in the Life of a Druid Implementor and Druid's Roadmap
A Day in the Life of a Druid Implementor and Druid's RoadmapA Day in the Life of a Druid Implementor and Druid's Roadmap
A Day in the Life of a Druid Implementor and Druid's Roadmap
 
Practical Medium Data Analytics with Python (10 Things I Hate About pandas, P...
Practical Medium Data Analytics with Python (10 Things I Hate About pandas, P...Practical Medium Data Analytics with Python (10 Things I Hate About pandas, P...
Practical Medium Data Analytics with Python (10 Things I Hate About pandas, P...
 
Seattle Scalability Mahout
Seattle Scalability MahoutSeattle Scalability Mahout
Seattle Scalability Mahout
 
NoSQL databases pros and cons
NoSQL databases pros and consNoSQL databases pros and cons
NoSQL databases pros and cons
 
NoSQL and MongoDB Introdction
NoSQL and MongoDB IntrodctionNoSQL and MongoDB Introdction
NoSQL and MongoDB Introdction
 
Bigdata antipatterns
Bigdata antipatternsBigdata antipatterns
Bigdata antipatterns
 
Building Better Analytics Workflows (Strata-Hadoop World 2013)
Building Better Analytics Workflows (Strata-Hadoop World 2013)Building Better Analytics Workflows (Strata-Hadoop World 2013)
Building Better Analytics Workflows (Strata-Hadoop World 2013)
 
Graph Databases for SQL Server Professionals
Graph Databases for SQL Server ProfessionalsGraph Databases for SQL Server Professionals
Graph Databases for SQL Server Professionals
 
HUG France Feb 2016 - Migration de données structurées entre Hadoop et RDBMS ...
HUG France Feb 2016 - Migration de données structurées entre Hadoop et RDBMS ...HUG France Feb 2016 - Migration de données structurées entre Hadoop et RDBMS ...
HUG France Feb 2016 - Migration de données structurées entre Hadoop et RDBMS ...
 
PyCon Singapore 2013 Keynote
PyCon Singapore 2013 KeynotePyCon Singapore 2013 Keynote
PyCon Singapore 2013 Keynote
 
AWS Customer Presentation: Freie Univerisitat - Berlin Summit 2012
AWS Customer Presentation: Freie Univerisitat - Berlin Summit 2012AWS Customer Presentation: Freie Univerisitat - Berlin Summit 2012
AWS Customer Presentation: Freie Univerisitat - Berlin Summit 2012
 
Improving data interoperability in Python and R
Improving data interoperability in Python and RImproving data interoperability in Python and R
Improving data interoperability in Python and R
 
Introduction to Google BigQuery
Introduction to Google BigQueryIntroduction to Google BigQuery
Introduction to Google BigQuery
 
Performance comparison: Multi-Model vs. MongoDB and Neo4j
Performance comparison: Multi-Model vs. MongoDB and Neo4jPerformance comparison: Multi-Model vs. MongoDB and Neo4j
Performance comparison: Multi-Model vs. MongoDB and Neo4j
 
Linked Process
Linked ProcessLinked Process
Linked Process
 
The Real-time Web in the Age of Agents
The Real-time Web in the Age of AgentsThe Real-time Web in the Age of Agents
The Real-time Web in the Age of Agents
 
Building data pipelines
Building data pipelinesBuilding data pipelines
Building data pipelines
 
Optiq: A dynamic data management framework
Optiq: A dynamic data management frameworkOptiq: A dynamic data management framework
Optiq: A dynamic data management framework
 
Presto @ Treasure Data - Presto Meetup Boston 2015
Presto @ Treasure Data - Presto Meetup Boston 2015Presto @ Treasure Data - Presto Meetup Boston 2015
Presto @ Treasure Data - Presto Meetup Boston 2015
 

Destacado

Destacado (9)

Practical Ruby Projects With Mongo Db
Practical Ruby Projects With Mongo DbPractical Ruby Projects With Mongo Db
Practical Ruby Projects With Mongo Db
 
Mongo db devfestw
Mongo db devfestwMongo db devfestw
Mongo db devfestw
 
From Oracle to MongoDB
From Oracle to MongoDBFrom Oracle to MongoDB
From Oracle to MongoDB
 
Migration from SQL to MongoDB - A Case Study at TheKnot.com
Migration from SQL to MongoDB - A Case Study at TheKnot.com Migration from SQL to MongoDB - A Case Study at TheKnot.com
Migration from SQL to MongoDB - A Case Study at TheKnot.com
 
Java and services code lab spring boot and spring data using mongo db
Java and services code lab spring boot and spring data using mongo dbJava and services code lab spring boot and spring data using mongo db
Java and services code lab spring boot and spring data using mongo db
 
Java and services code lab spring boot and spring data using mongo db
Java and services code lab spring boot and spring data using mongo dbJava and services code lab spring boot and spring data using mongo db
Java and services code lab spring boot and spring data using mongo db
 
Angular 2 : le réveil de la force
Angular 2 : le réveil de la forceAngular 2 : le réveil de la force
Angular 2 : le réveil de la force
 
Building Universal Applications with Angular 2
Building Universal Applications with Angular 2Building Universal Applications with Angular 2
Building Universal Applications with Angular 2
 
introduction à MongoDB
introduction à MongoDBintroduction à MongoDB
introduction à MongoDB
 

Similar a Mongo db with spring data document

Java Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBJava Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDB
MongoDB
 
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
Tobias Trelle
 
Mongodb at-gilt-groupe-seattle-2012-09-14-final
Mongodb at-gilt-groupe-seattle-2012-09-14-finalMongodb at-gilt-groupe-seattle-2012-09-14-final
Mongodb at-gilt-groupe-seattle-2012-09-14-final
MongoDB
 
Lessons Learned from Building a Multi-Tenant Saas Content Management System o...
Lessons Learned from Building a Multi-Tenant Saas Content Management System o...Lessons Learned from Building a Multi-Tenant Saas Content Management System o...
Lessons Learned from Building a Multi-Tenant Saas Content Management System o...
MongoDB
 

Similar a Mongo db with spring data document (20)

Using NoSQL with Yo' SQL
Using NoSQL with Yo' SQLUsing NoSQL with Yo' SQL
Using NoSQL with Yo' SQL
 
Flowdock's full-text search with MongoDB
Flowdock's full-text search with MongoDBFlowdock's full-text search with MongoDB
Flowdock's full-text search with MongoDB
 
MongoDB Pros and Cons
MongoDB Pros and ConsMongoDB Pros and Cons
MongoDB Pros and Cons
 
Rapid web development using tornado web and mongodb
Rapid web development using tornado web and mongodbRapid web development using tornado web and mongodb
Rapid web development using tornado web and mongodb
 
Spring Data MongoDB 介紹
Spring Data MongoDB 介紹Spring Data MongoDB 介紹
Spring Data MongoDB 介紹
 
Mongo learning series
Mongo learning series Mongo learning series
Mongo learning series
 
Java Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBJava Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDB
 
MongoDB presentation
MongoDB presentationMongoDB presentation
MongoDB presentation
 
CloudFoundry and MongoDb, a marriage made in heaven
CloudFoundry and MongoDb, a marriage made in heavenCloudFoundry and MongoDb, a marriage made in heaven
CloudFoundry and MongoDb, a marriage made in heaven
 
Java Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBJava Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDB
 
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 at-gilt-groupe-seattle-2012-09-14-final
Mongodb at-gilt-groupe-seattle-2012-09-14-finalMongodb at-gilt-groupe-seattle-2012-09-14-final
Mongodb at-gilt-groupe-seattle-2012-09-14-final
 
Lessons Learned from Building a Multi-Tenant Saas Content Management System o...
Lessons Learned from Building a Multi-Tenant Saas Content Management System o...Lessons Learned from Building a Multi-Tenant Saas Content Management System o...
Lessons Learned from Building a Multi-Tenant Saas Content Management System o...
 
A Brief MongoDB Intro
A Brief MongoDB IntroA Brief MongoDB Intro
A Brief MongoDB Intro
 
Introduction to Mongodb
Introduction to MongodbIntroduction to Mongodb
Introduction to Mongodb
 
MongoDB
MongoDBMongoDB
MongoDB
 
moma-django overview --> Django + MongoDB: building a custom ORM layer
moma-django overview --> Django + MongoDB: building a custom ORM layermoma-django overview --> Django + MongoDB: building a custom ORM layer
moma-django overview --> Django + MongoDB: building a custom ORM layer
 
Open-Source Analytics Stack on MongoDB, with Schema, Pierre-Alain Jachiet and...
Open-Source Analytics Stack on MongoDB, with Schema, Pierre-Alain Jachiet and...Open-Source Analytics Stack on MongoDB, with Schema, Pierre-Alain Jachiet and...
Open-Source Analytics Stack on MongoDB, with Schema, Pierre-Alain Jachiet and...
 
MongoDB Introduction and Data Modelling
MongoDB Introduction and Data Modelling MongoDB Introduction and Data Modelling
MongoDB Introduction and Data Modelling
 
Mongo db pefrormance optimization strategies
Mongo db pefrormance optimization strategiesMongo db pefrormance optimization strategies
Mongo db pefrormance optimization strategies
 

Más de Sean Lee

Más de Sean Lee (8)

Git rerere
Git rerereGit rerere
Git rerere
 
Cloud foundry practice
Cloud foundry practiceCloud foundry practice
Cloud foundry practice
 
Redis with spring data key value
Redis with spring data key valueRedis with spring data key value
Redis with spring data key value
 
ePUB in brief
ePUB in briefePUB in brief
ePUB in brief
 
트렌드 코리아 2011
트렌드 코리아 2011트렌드 코리아 2011
트렌드 코리아 2011
 
Future Health Care 3
Future Health Care 3Future Health Care 3
Future Health Care 3
 
Future Health Care 3
Future Health Care 3Future Health Care 3
Future Health Care 3
 
미래를 읽는 기술(Future Inc) Pechakucha
미래를 읽는 기술(Future Inc) Pechakucha미래를 읽는 기술(Future Inc) Pechakucha
미래를 읽는 기술(Future Inc) Pechakucha
 

Último

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Último (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

Mongo db with spring data document

  • 1. MongoDB with Spring Data Document Sean@Weaveus May 2011
  • 2. <<interface>> @Autowired Mongo Operations Bean Mongo Template Bean MongoDB Driver Monday, May 9, 2011 2
  • 3. DB Collection#1 Collection#2 Document#1 Document#1 Document#2 Document#2 Document#3 Document#3 Document#4 Document#4 Document#5 Document#5 Document := {UniqueID, JSON Document} Monday, May 9, 2011 3
  • 4. Getting Started - Server SeaniMac:tmp sean$ ls mongodb-osx-x86_64-1.8.1.tgz mongodb-osx-x86_64-1.8.1 SeaniMac:tmp sean$ mkdir -p mongodb-data/db SeaniMac:tmp sean$ ./mongodb-osx-x86_64-1.8.1/bin/mongod --dbpath ./ mongodb-data/db Fri May! 6 14:16:48 [initandlisten] MongoDB starting ... ... Monday, May 9, 2011 4
  • 5. Getting Started - Client SeaniMac:tmp sean$ ./mongodb-osx-x86_64-1.8.1/bin/mongo MongoDB shell version: 1.8.1 connecting to: test > db.foo.save( { a: 1 } ) > db.foo.find() { "_id" : ObjectId("4dc3855d3044bae59620330d"), "a" : 1 } Monday, May 9, 2011 5
  • 6. Java(Groovy) import com.mongodb.Mongo import com.mongodb.DB import com.mongodb.DBCollection Mongo m = new Mongo() println m.databaseNames DB db = m.getDB("test") println db.collectionNames DBCollection dbcol = db.getCollection("foo") println dbcol.find().next() // DBObject Instance, BSON // results [test, admin, db, foo, local] [foo, system.indexes] [_id:4dc3855d3044bae59620330d, a:1.0] Monday, May 9, 2011 6
  • 8. Save > db.things.save({ name: "mongo" }) > t = { x : 3 } { "x" : 3 } > db.things.save(t) Monday, May 9, 2011 8
  • 9. Find > db.things.find() { "_id" : ObjectId("4dc399fc3044bae59620330e"), "name" : "mongo" } { "_id" : ObjectId("4dc3a7913044bae59620330f"), "x" : 3 } > var cursor = db.things.find(); > while (cursor.hasNext()) printjson(cursor.next()); { "_id" : ObjectId("4dc399fc3044bae59620330e"), "name" : "mongo" } { "_id" : ObjectId("4dc3a7913044bae59620330f"), "x" : 3 } > db.things.find().forEach( printjson ) { "_id" : ObjectId("4dc399fc3044bae59620330e"), "name" : "mongo" } { "_id" : ObjectId("4dc3a7913044bae59620330f"), "x" : 3 } > db.things.find({name:"mongo"}).forEach( printjson ); { "_id" : ObjectId("4dc399fc3044bae59620330e"), "name" : "mongo" } > db.things.save( {"name":"nosql", "title":"nonRDB"} ) > db.things.find( {name:"nosql"}, {title:true} ).forEach ( printjson ) { "_id" : ObjectId("4dc3ae133044bae596203312"), "title" : "nonRDB" } Monday, May 9, 2011 9
  • 10. Remove > db.things.remove({name:"mongo"}) > db.things.remove({"_id":ObjectId("4dc3ae133044bae596203312")}) > db.things.find()!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! { "_id" : ObjectId("4dc3a7913044bae59620330f"), "x" : 3 } Monday, May 9, 2011 10
  • 11. with Spring Data Monday, May 9, 2011 11
  • 12. MongoTemplate • Document databases extension to Spring Programming Model • SPEL • DataException hierarchy • IoC Configuration Monday, May 9, 2011 12
  • 13. Beans @Configuration or XML-Based Monday, May 9, 2011 13
  • 14. <<interface>> Mongo Mongo @Autowired Repository Operations Mongo Criteria Bean Mongo Template Bean MongoDB Driver Monday, May 9, 2011 14
  • 15. Object-Document Implicit Conversion Monday, May 9, 2011 15
  • 16. MongoRepository • Method name based Query • @Query, QueryDSL • Criteria, Predication Support • GPS Query • Mapping • @Document(Instead of @Entity) • Asynchronous Callback Monday, May 9, 2011 16