SlideShare ist ein Scribd-Unternehmen logo
1 von 71
Downloaden Sie, um offline zu lesen
Thursday Nov 29th - 10:00am PST / 1:00pm EST / 6:00pm GMT




      MongoDB on the JVM
       Trisha Gee, Java Developer, 10gen
       trisha.gee@10gen.com
       @trisha_gee




Thursday, November 29, 12
Today’s Webinar
       • Overview of MongoDB
       • Using MongoDB from Java
       • Expanding to other JVM languages
       • Other tools for Java developers




Thursday, November 29, 12
What is MongoDB?




Thursday, November 29, 12
Designed to fit your application
       • Agile
       • Scalable
       • Highly Available




Thursday, November 29, 12
Document Oriented
       {
           “title”: “Programming Erlang: Software for a Concurrent World”,
           “author”: “Joe Armstrong”,
           “publicationYear”: 2007,
           “publisher”: “The Pragmatic Programmers, LLC”,
       }




Thursday, November 29, 12
Document Oriented
       {
           “title”: “Programming Erlang: Software for a Concurrent World”,
           “author”: “Joe Armstrong”,
           “publicationYear”: 2007,
           “price”: {
                "currency": "USD",
                "discount": 24.14,
                "msrp": 36.95
           },
           “publisher”: “The Pragmatic Programmers, LLC”,
       }




Thursday, November 29, 12
Document Oriented
       {
           “title”: “Programming Erlang: Software for a Concurrent World”,
           “author”: “Joe Armstrong”,
           “publicationYear”: 2007,
           “price”: {
                "currency": "USD",
                "discount": 24.14,
                "msrp": 36.95
           },
           “publisher”: “The Pragmatic Programmers, LLC”, “tags”: [
              “erlang”,
              “concurrent programming”,
              “multicore”,
              “programming”
           ]
       }




Thursday, November 29, 12
Scalability
       Database should grow and scale with our
       application




Thursday, November 29, 12
Scalability
       • Replica Sets: Robust replication model with
          automatic failover
       • Sharding: n-scalable horizontal partitioning with
          automatic management




Thursday, November 29, 12
Insert Picture/Table/Chart Here (but if picture
       doesn’t have a background, be sure to remove gray
       background, border, and shadow!)




       Replica Set

Thursday, November 29, 12
Read




                  MongoD


                            Write


       Sharding

Thursday, November 29, 12
Read




                 Secondary


                 Secondary


                  MongoD
                  Primary


                             Write


       Sharding

Thursday, November 29, 12
Read

                   Shard1

                 Secondary


                 Secondary


                  MongoD
                  Primary


                             Write


       Sharding

Thursday, November 29, 12
Read

                   Shard1     Shard2

                 Secondary   Secondary


                 Secondary   Secondary


                  MongoD
                  Primary     Primary


                                         Write


       Sharding

Thursday, November 29, 12
Read

                   Shard1     Shard2      Shard3

                 Secondary   Secondary   Secondary


                 Secondary   Secondary   Secondary


                  MongoD
                  Primary     Primary     Primary


                                                     Write


       Sharding

Thursday, November 29, 12
Working with MongoDB




Thursday, November 29, 12
MongoDB Drivers
       • Official support for 12 languages
       • Community drivers for many more
       • Drivers have two main responsibilities:
           •Connecting to MongoDB servers
           •Translating BSON into native types




Thursday, November 29, 12
Java and the JVM
       • Core Java driver
       • Python driver
       • JRuby driver
       • Scala driver
       • Clojure community driver - Monger
       • Higher Level Frameworks - ODMs




Thursday, November 29, 12
Using the Java Driver




Thursday, November 29, 12
Connecting




Thursday, November 29, 12
Connecting
       com.mongodb.MongoClient mongoClient = new MongoClient(
                            serverName, port);




Thursday, November 29, 12
Connecting
       com.mongodb.MongoClient mongoClient = new MongoClient();
       com.mongodb.DB db = mongoClient.getDB( "bookstore" );




Thursday, November 29, 12
Connecting
       com.mongodb.MongoClient mongoClient = new MongoClient();
       com.mongodb.DB db = mongoClient.getDB( "bookstore" );
       com.mongodb.DBCollection coll = db.getCollection( "books" );




Thursday, November 29, 12
Inserting




Thursday, November 29, 12
Inserting
       com.mongodb.DBCollection coll = db.getCollection( "books" );

       ...

       com.mongodb.DBObject newBook = new BasicDBObject();
       newBook.put( “title”, “Java Concurrency in Practice” );
       newBook.put( “author”, “Brian Goetz” );
       newBook.put( “price”,
              new BasicDBObject( “msrp”, 38.99 ) );




Thursday, November 29, 12
Inserting
       com.mongodb.DBCollection coll = db.getCollection( "books" );

       ...

       com.mongodb.DBObject newBook = new BasicDBObject();
       newBook.put( “title”, “Java Concurrency in Practice” );
       newBook.put( “author”, “Brian Goetz” );
       newBook.put( “price”,
              new BasicDBObject( “msrp”, 38.99 ) );




Thursday, November 29, 12
Inserting
       com.mongodb.DBCollection coll = db.getCollection( "books" );

       ...

       com.mongodb.DBObject newBook = new BasicDBObject();
       newBook.put( “title”, “Java Concurrency in Practice” );
       newBook.put( “author”, “Brian Goetz” );
       newBook.put( “price”,
              new BasicDBObject( “msrp”, 38.99 ) );

       coll.insert(newBook);




Thursday, November 29, 12
Querying




Thursday, November 29, 12
Querying
       com.mongodb.DBObject query = new BasicDBObject();
       query.put( “tag”, “java” );
       query.put( “price”,
              new BasicDBObject( “$lt”, 40.00 ) );




Thursday, November 29, 12
Querying
       com.mongodb.DBObject query = new BasicDBObject();
       query.put( “tag”, “java” );
       query.put( “price”,
              new BasicDBObject( “$lt”, 40.00 ) );




Thursday, November 29, 12
Querying
       com.mongodb.DBObject query = new BasicDBObject();
       query.put( “tag”, “java” );
       query.put( “price”,
              new BasicDBObject( “$lt”, 40.00 ) );

       for ( DBObject doc : coll.find( query ) ) {
          // ...for every document found, do something...
       }




Thursday, November 29, 12
Query Builder
       DBObject query = QueryBuilder.start( “price” )
                        .lessThan( 40.00 )
                        .and( “tag” )
                        .is( “java” ).get();




Thursday, November 29, 12
Query Builder
       DBObject query = QueryBuilder.start( “price” )
                       .lessThan( 40.00 )
                       .and( “tag” )
                       .is( “java” ).get();

       DBObject query = new BasicDBObject();
       query.put( “tag”, “java” );
       query.put( “price”,
             new BasicDBObject( “$lt”, 40.00 ) );




Thursday, November 29, 12
Other JVM Languages




Thursday, November 29, 12
Jython
       • Allows Python’s clear syntax on the JVM
       • PyMongo uses native python code and has no
          hooks into the Java driver
       • Some care needed to ensure cursors are closed
          due to different garbage collection models.




Thursday, November 29, 12
JRuby
       • Support for JRuby 1.6.x and 1.7.x
       • Native Java extensions are bundled in with the
          BSON gem.
       • Utilises the Java driver for improved BSON
          decoding and performance.




Thursday, November 29, 12
Clojure
       • Clojure - http://clojuremongodb.info/




Thursday, November 29, 12
Scala Driver
       • Wraps the Java driver
       • Provide idiomatic Scala interface to MongoDB




Thursday, November 29, 12
Scala




Thursday, November 29, 12
Scala
       case class Book(id: ObjectId, author: String,
                 isbn: String, price: Price,
                 year: Int, tags: Seq[String],
                 title: String, publisher: String,
                 edition: Option[String]) {

            def toDBObject = MongoDBObject(
                      "author" -> author,
                      "_id" -> id,
                      "isbn" -> isbn,
                      "price" -> price.toDBObject,
                      "publicationYear" -> year,
                      "tags" -> tags,
                      "title" -> title,
                      "publisher" -> publisher,
                      "edition" -> edition
                    )
       }

Thursday, November 29, 12
Scala
       val builder = MongoDBObject.newBuilder
       builder += "foo" -> "bar"
       builder += "x" -> 5
       builder += "map" -> Map("spam" -> 8.2, "eggs" -> "bacon")
       val dbObj = builder.result




Thursday, November 29, 12
Scala
       val mongo: MongoCollection = MongoConnection()("bookstore")("books")




Thursday, November 29, 12
Scala
       val mongo: MongoCollection = MongoConnection()("bookstore")("books")

       def findAll() = for ( book <- mongo.find() ) yield new Book(book)
       findAll().foreach(b => println("<Book> " + b))




Thursday, November 29, 12
Scala
       val mongo: MongoCollection = MongoConnection()("bookstore")("books")

       def findAll() = for ( book <- mongo.find() ) yield newBook(book)
       findAll().foreach(b => println("<Book> " + b))

       val query: DBObject = ("price" $lt 40.00) ++ ("tag" -> "scala")




Thursday, November 29, 12
Other Scala Projects
       • Hammersmith - Netty + Akka.IO interfaces, strongly
          functional and callback based
       • ReactiveMongo - from the amazing team @
          Zenexity who brought us the Play! Framework




Thursday, November 29, 12
Higher Level Abstractions




Thursday, November 29, 12
Morphia




Thursday, November 29, 12
Morphia
       @Entity("books") // MongoDB collection to use
       class Book {
          public Book () {
          }

           // ...
       }




Thursday, November 29, 12
Morphia
       @Entity("books")
       class Book {
          @Id private ObjectId id;

           public Book () {
           }

           // ...
       }




Thursday, November 29, 12
Morphia
       @Entity("books")
       class Book {
          @Id private ObjectId id;
          private List<String> tags = new ArrayList<String>();

           public Book () {
           }

           // ...
       }




Thursday, November 29, 12
Morphia
       @Entity("books")
       class Book {
          @Id private ObjectId id;
          private List<String> tags = new ArrayList<String>();
          @Embedded private Price price;

           public Book () {
           }

           // ...
       }

       @Embedded
       class Price {
          // ...
       }




Thursday, November 29, 12
Morphia
       @Entity("books")
       class Book {
          @Id private ObjectId id;
          private List<String> tags = new ArrayList<String>();
          @Embedded private Price price;
          @Reference private Author author;

           public Book () {
           }

           // ...
       }

       @Entity("authors")
       class Author {
          // ...
       }


Thursday, November 29, 12
Morphia
       @Entity("books")
       class Book {
          @Id private ObjectId id;
          private List<String> tags = new ArrayList<String>();
          @Embedded private Price price;
          @Reference private Author author;
          @Property("publicationYear") private int year;

           public Book () {
           }

           // ...
       }




Thursday, November 29, 12
Spring Data




Thursday, November 29, 12
Spring Data Document
       @Document(collection=“books”)
       public class Book {

       
    // ...

       }




Thursday, November 29, 12
Spring Data Document
       @Document(collection=“books”)
       public class Book {
         @Id private String id;

       }




Thursday, November 29, 12
Spring Data Document
       @Document(collection=“books”)
       public class Book {
         @Id private String id;
         private List<String> tags = new ArrayList<String>();
         private Price price;

       }




Thursday, November 29, 12
Spring Data Document
       @Document(collection=“books”)
       public class Book {
         @Id private String id;
         private List<String> tags = new ArrayList<String>();
         private Price price;
         @DBRef private Author author;

       }




Thursday, November 29, 12
Spring Data Document
       @Document(collection=“books”)
       public class Book {
         @Id private String id;
         private List<String> tags = new ArrayList<String>();
         private Price price;
         @DBRef private Author author;
         @Field("publicationYear") private int year;

       }




Thursday, November 29, 12
Spring Data Configuration
       <?xml version="1.0" encoding="UTF-8"?>
       <beans
         ...
       
     xmlns:mongo="http://www.springframework.org/schema/data/mongo"
       
    xsi:schemaLocation="
            ...
            http://www.springframework.org/schema/data/mongo
            http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd">

       
    <mongo:mongo id="mongo" >
       
     <mongo:options auto-connect-retry="true" />
       
    </mongo:mongo>

       
   <bean id="mongoTemplate"
            class="org.springframework.data.mongodb.core.MongoTemplate">
          <constructor-arg ref="mongo" />
       
    <constructor-arg value="news" />
       
   </bean>
         <mongo:repositories base-package="org.mongodb.news.repositories"/>
       </beans>



Thursday, November 29, 12
Spring Data - Connecting
       ApplicationContext ctx = new ClassPathXmlApplicationContext(
       
   
    
   
            "spring-context.xml");

       MongoOperations ops = ctx.getBean("mongoTemplate",
       
  
  
   
               MongoOperations.class);




Thursday, November 29, 12
Spring Data - Inserting
       ApplicationContext ctx = new ClassPathXmlApplicationContext(
       
   
    
   
            "spring-context.xml");

       MongoOperations ops = ctx.getBean("mongoTemplate",
       
  
  
   
                MongoOperations.class);

       Book book = new Book();
       // set fields on the book
       // ...

       ops.insert(book);




Thursday, November 29, 12
Spring Data - Querying
       MongoOperations ops = ctx.getBean("mongoTemplate",
       
  
  
   
                MongoOperations.class);

       Book book = ops.findOne(query(where("price").lt(40)),
                    Book.class);




Thursday, November 29, 12
Spring Data - Querying
       MongoOperations ops = ctx.getBean("mongoTemplate",
       
  
  
   
                MongoOperations.class);

       Book book = ops.findOne(query(where("price").lt(40)),
                    Book.class);

       book = ops.findById(book.getId(), Book.class);




Thursday, November 29, 12
Spring Data - Querying
       ApplicationContext ctx = new ClassPathXmlApplicationContext(
       
   
    
   
            "spring-context.xml");

       BookRepository repo = ctx.getBean("bookRepository",
       
  
   
   
               BookRepository.class);




Thursday, November 29, 12
Spring Data - Querying
       ApplicationContext ctx = new ClassPathXmlApplicationContext(
       
   
    
   
            "spring-context.xml");

       BookRepository repo = ctx.getBean("bookRepository",
       
   
  
    
               BookRepository.class);

       Book book = repo.findByAuthor("Eric");




Thursday, November 29, 12
Spring Data - Querying
       public interface BookRepository extends
                  CrudRepository<Book, String> {

       
    public Book findByAuthor(String author);
       }




Thursday, November 29, 12
Spring Data Configuration
       <?xml version="1.0" encoding="UTF-8"?>
       <beans
         ...
       
     xmlns:mongo="http://www.springframework.org/schema/data/mongo"
       
    xsi:schemaLocation="
            ...
            http://www.springframework.org/schema/data/mongo
            http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd">

       
    <mongo:mongo id="mongo" >
       
     <mongo:options auto-connect-retry="true" />
       
    </mongo:mongo>

       
   <bean id="mongoTemplate"
            class="org.springframework.data.mongodb.core.MongoTemplate">
          <constructor-arg ref="mongo" />
       
    <constructor-arg value="news" />
       
   </bean>
         <mongo:repositories base-package="org.mongodb.news.repositories"/>
       </beans>



Thursday, November 29, 12
In Summary
       • MongoDB is an agile, scalable NoSQL database
       • If you’re coding on the JVM you have many options
          for interacting with MongoDB
           •Multiple native drivers
           •Frameworks to simplify development




Thursday, November 29, 12
More Information
           Resource                          Location
           MongoDB Downloads                 www.mongodb.org/downloads

           Free Online Training              education.10gen.com

           Webinars and Events               www.10gen.com/events

           White Papers                      www.10gen.com/white-papers

           Customer Case Studies             www.10gen.com/customers

           Presentations                     www.10gen.com/presentations

           Documentation                     docs.mongodb.org

           Additional Info                   info@10gen.com



                                   trisha.gee@10gen.com

                                       @trisha_gee
Thursday, November 29, 12
More Information
       • http://www.mongodb.org/display/DOCS/Drivers

       • http://code.google.com/p/morphia/

       • http://www.springsource.org/spring-data/mongodb




                               trisha.gee@10gen.com

                                   @trisha_gee
Thursday, November 29, 12

Weitere ähnliche Inhalte

Ähnlich wie Webinar: MongoDB on the JVM

Mongo db php_shaken_not_stirred_joomlafrappe
Mongo db php_shaken_not_stirred_joomlafrappeMongo db php_shaken_not_stirred_joomlafrappe
Mongo db php_shaken_not_stirred_joomlafrappeSpyros Passas
 
Morning with MongoDB Paris 2012 - Accueil et Introductions
Morning with MongoDB Paris 2012 - Accueil et IntroductionsMorning with MongoDB Paris 2012 - Accueil et Introductions
Morning with MongoDB Paris 2012 - Accueil et IntroductionsMongoDB
 
Schema Design
Schema DesignSchema Design
Schema DesignMongoDB
 
Thomas risberg mongosv-2012-spring-data-cloud-foundry
Thomas risberg mongosv-2012-spring-data-cloud-foundryThomas risberg mongosv-2012-spring-data-cloud-foundry
Thomas risberg mongosv-2012-spring-data-cloud-foundrytrisberg
 
NoSQL: Death to Relational Databases(?)
NoSQL: Death to Relational Databases(?)NoSQL: Death to Relational Databases(?)
NoSQL: Death to Relational Databases(?)Ben Scofield
 
Secrets of the asset pipeline
Secrets of the asset pipelineSecrets of the asset pipeline
Secrets of the asset pipelineKen Collins
 
MongoDB @ Frankfurt NoSql User Group
MongoDB @  Frankfurt NoSql User GroupMongoDB @  Frankfurt NoSql User Group
MongoDB @ Frankfurt NoSql User GroupChris Harris
 
A Morning with MongoDB Barcelona: Introduction
A Morning with MongoDB Barcelona: IntroductionA Morning with MongoDB Barcelona: Introduction
A Morning with MongoDB Barcelona: IntroductionMongoDB
 
Mike Krieger, Instagram, Warm Gun 2012
Mike Krieger, Instagram, Warm Gun 2012Mike Krieger, Instagram, Warm Gun 2012
Mike Krieger, Instagram, Warm Gun 2012500 Startups
 
Bdd intro for Microsoft, 29 Nov 2012
Bdd intro for Microsoft, 29 Nov 2012Bdd intro for Microsoft, 29 Nov 2012
Bdd intro for Microsoft, 29 Nov 2012Aliaksandr Ikhelis
 
Hands on with Ruby & MongoDB
Hands on with Ruby & MongoDBHands on with Ruby & MongoDB
Hands on with Ruby & MongoDBWynn Netherland
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBMike Dirolf
 
Use Your MySQL Knowledge to Become a MongoDB Guru
Use Your MySQL Knowledge to Become a MongoDB GuruUse Your MySQL Knowledge to Become a MongoDB Guru
Use Your MySQL Knowledge to Become a MongoDB GuruTim Callaghan
 
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 heavenPatrick Chanezon
 
MongoDB at FrozenRails
MongoDB at FrozenRailsMongoDB at FrozenRails
MongoDB at FrozenRailsMike Dirolf
 

Ähnlich wie Webinar: MongoDB on the JVM (20)

Mongo db php_shaken_not_stirred_joomlafrappe
Mongo db php_shaken_not_stirred_joomlafrappeMongo db php_shaken_not_stirred_joomlafrappe
Mongo db php_shaken_not_stirred_joomlafrappe
 
Morning with MongoDB Paris 2012 - Accueil et Introductions
Morning with MongoDB Paris 2012 - Accueil et IntroductionsMorning with MongoDB Paris 2012 - Accueil et Introductions
Morning with MongoDB Paris 2012 - Accueil et Introductions
 
Schema Design
Schema DesignSchema Design
Schema Design
 
Thomas risberg mongosv-2012-spring-data-cloud-foundry
Thomas risberg mongosv-2012-spring-data-cloud-foundryThomas risberg mongosv-2012-spring-data-cloud-foundry
Thomas risberg mongosv-2012-spring-data-cloud-foundry
 
NoSQL: Death to Relational Databases(?)
NoSQL: Death to Relational Databases(?)NoSQL: Death to Relational Databases(?)
NoSQL: Death to Relational Databases(?)
 
Secrets of the asset pipeline
Secrets of the asset pipelineSecrets of the asset pipeline
Secrets of the asset pipeline
 
MongoDB @ Frankfurt NoSql User Group
MongoDB @  Frankfurt NoSql User GroupMongoDB @  Frankfurt NoSql User Group
MongoDB @ Frankfurt NoSql User Group
 
Jongo mongo sv
Jongo mongo svJongo mongo sv
Jongo mongo sv
 
Mongo db japan
Mongo db japanMongo db japan
Mongo db japan
 
A Morning with MongoDB Barcelona: Introduction
A Morning with MongoDB Barcelona: IntroductionA Morning with MongoDB Barcelona: Introduction
A Morning with MongoDB Barcelona: Introduction
 
Mike Krieger, Instagram, Warm Gun 2012
Mike Krieger, Instagram, Warm Gun 2012Mike Krieger, Instagram, Warm Gun 2012
Mike Krieger, Instagram, Warm Gun 2012
 
Latinoware
LatinowareLatinoware
Latinoware
 
Bdd intro for Microsoft, 29 Nov 2012
Bdd intro for Microsoft, 29 Nov 2012Bdd intro for Microsoft, 29 Nov 2012
Bdd intro for Microsoft, 29 Nov 2012
 
Hands on with Ruby & MongoDB
Hands on with Ruby & MongoDBHands on with Ruby & MongoDB
Hands on with Ruby & MongoDB
 
MongoDB at RuPy
MongoDB at RuPyMongoDB at RuPy
MongoDB at RuPy
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Use Your MySQL Knowledge to Become a MongoDB Guru
Use Your MySQL Knowledge to Become a MongoDB GuruUse Your MySQL Knowledge to Become a MongoDB Guru
Use Your MySQL Knowledge to Become a MongoDB Guru
 
DEVCON1 - BooJs
DEVCON1 - BooJsDEVCON1 - BooJs
DEVCON1 - BooJs
 
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
 
MongoDB at FrozenRails
MongoDB at FrozenRailsMongoDB at FrozenRails
MongoDB at FrozenRails
 

Mehr von MongoDB

MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB
 
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB
 
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB
 
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB
 
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...MongoDB
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB
 
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 MongoDB SoCal 2020: MongoDB Atlas Jump Start MongoDB SoCal 2020: MongoDB Atlas Jump Start
MongoDB SoCal 2020: MongoDB Atlas Jump StartMongoDB
 
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]MongoDB
 
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB
 
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB
 
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!MongoDB
 
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your MindsetMongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your MindsetMongoDB
 
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas JumpstartMongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas JumpstartMongoDB
 
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB
 
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++MongoDB
 
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...MongoDB
 
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep DiveMongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep DiveMongoDB
 
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & GolangMongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & GolangMongoDB
 
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB
 
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...MongoDB
 

Mehr von MongoDB (20)

MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
 
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
 
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
 
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
 
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
 
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 MongoDB SoCal 2020: MongoDB Atlas Jump Start MongoDB SoCal 2020: MongoDB Atlas Jump Start
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
 
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
 
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
 
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
 
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your MindsetMongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
 
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas JumpstartMongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
 
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
 
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
 
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
 
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep DiveMongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
 
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & GolangMongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
 
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
 
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
 

Kürzlich hochgeladen

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
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
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
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
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 

Kürzlich hochgeladen (20)

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
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
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
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!
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 

Webinar: MongoDB on the JVM

  • 1. Thursday Nov 29th - 10:00am PST / 1:00pm EST / 6:00pm GMT MongoDB on the JVM Trisha Gee, Java Developer, 10gen trisha.gee@10gen.com @trisha_gee Thursday, November 29, 12
  • 2. Today’s Webinar • Overview of MongoDB • Using MongoDB from Java • Expanding to other JVM languages • Other tools for Java developers Thursday, November 29, 12
  • 3. What is MongoDB? Thursday, November 29, 12
  • 4. Designed to fit your application • Agile • Scalable • Highly Available Thursday, November 29, 12
  • 5. Document Oriented { “title”: “Programming Erlang: Software for a Concurrent World”, “author”: “Joe Armstrong”, “publicationYear”: 2007, “publisher”: “The Pragmatic Programmers, LLC”, } Thursday, November 29, 12
  • 6. Document Oriented { “title”: “Programming Erlang: Software for a Concurrent World”, “author”: “Joe Armstrong”, “publicationYear”: 2007, “price”: { "currency": "USD", "discount": 24.14, "msrp": 36.95 }, “publisher”: “The Pragmatic Programmers, LLC”, } Thursday, November 29, 12
  • 7. Document Oriented { “title”: “Programming Erlang: Software for a Concurrent World”, “author”: “Joe Armstrong”, “publicationYear”: 2007, “price”: { "currency": "USD", "discount": 24.14, "msrp": 36.95 }, “publisher”: “The Pragmatic Programmers, LLC”, “tags”: [ “erlang”, “concurrent programming”, “multicore”, “programming” ] } Thursday, November 29, 12
  • 8. Scalability Database should grow and scale with our application Thursday, November 29, 12
  • 9. Scalability • Replica Sets: Robust replication model with automatic failover • Sharding: n-scalable horizontal partitioning with automatic management Thursday, November 29, 12
  • 10. Insert Picture/Table/Chart Here (but if picture doesn’t have a background, be sure to remove gray background, border, and shadow!) Replica Set Thursday, November 29, 12
  • 11. Read MongoD Write Sharding Thursday, November 29, 12
  • 12. Read Secondary Secondary MongoD Primary Write Sharding Thursday, November 29, 12
  • 13. Read Shard1 Secondary Secondary MongoD Primary Write Sharding Thursday, November 29, 12
  • 14. Read Shard1 Shard2 Secondary Secondary Secondary Secondary MongoD Primary Primary Write Sharding Thursday, November 29, 12
  • 15. Read Shard1 Shard2 Shard3 Secondary Secondary Secondary Secondary Secondary Secondary MongoD Primary Primary Primary Write Sharding Thursday, November 29, 12
  • 17. MongoDB Drivers • Official support for 12 languages • Community drivers for many more • Drivers have two main responsibilities: •Connecting to MongoDB servers •Translating BSON into native types Thursday, November 29, 12
  • 18. Java and the JVM • Core Java driver • Python driver • JRuby driver • Scala driver • Clojure community driver - Monger • Higher Level Frameworks - ODMs Thursday, November 29, 12
  • 19. Using the Java Driver Thursday, November 29, 12
  • 21. Connecting com.mongodb.MongoClient mongoClient = new MongoClient( serverName, port); Thursday, November 29, 12
  • 22. Connecting com.mongodb.MongoClient mongoClient = new MongoClient(); com.mongodb.DB db = mongoClient.getDB( "bookstore" ); Thursday, November 29, 12
  • 23. Connecting com.mongodb.MongoClient mongoClient = new MongoClient(); com.mongodb.DB db = mongoClient.getDB( "bookstore" ); com.mongodb.DBCollection coll = db.getCollection( "books" ); Thursday, November 29, 12
  • 25. Inserting com.mongodb.DBCollection coll = db.getCollection( "books" ); ... com.mongodb.DBObject newBook = new BasicDBObject(); newBook.put( “title”, “Java Concurrency in Practice” ); newBook.put( “author”, “Brian Goetz” ); newBook.put( “price”, new BasicDBObject( “msrp”, 38.99 ) ); Thursday, November 29, 12
  • 26. Inserting com.mongodb.DBCollection coll = db.getCollection( "books" ); ... com.mongodb.DBObject newBook = new BasicDBObject(); newBook.put( “title”, “Java Concurrency in Practice” ); newBook.put( “author”, “Brian Goetz” ); newBook.put( “price”, new BasicDBObject( “msrp”, 38.99 ) ); Thursday, November 29, 12
  • 27. Inserting com.mongodb.DBCollection coll = db.getCollection( "books" ); ... com.mongodb.DBObject newBook = new BasicDBObject(); newBook.put( “title”, “Java Concurrency in Practice” ); newBook.put( “author”, “Brian Goetz” ); newBook.put( “price”, new BasicDBObject( “msrp”, 38.99 ) ); coll.insert(newBook); Thursday, November 29, 12
  • 29. Querying com.mongodb.DBObject query = new BasicDBObject(); query.put( “tag”, “java” ); query.put( “price”, new BasicDBObject( “$lt”, 40.00 ) ); Thursday, November 29, 12
  • 30. Querying com.mongodb.DBObject query = new BasicDBObject(); query.put( “tag”, “java” ); query.put( “price”, new BasicDBObject( “$lt”, 40.00 ) ); Thursday, November 29, 12
  • 31. Querying com.mongodb.DBObject query = new BasicDBObject(); query.put( “tag”, “java” ); query.put( “price”, new BasicDBObject( “$lt”, 40.00 ) ); for ( DBObject doc : coll.find( query ) ) { // ...for every document found, do something... } Thursday, November 29, 12
  • 32. Query Builder DBObject query = QueryBuilder.start( “price” ) .lessThan( 40.00 ) .and( “tag” ) .is( “java” ).get(); Thursday, November 29, 12
  • 33. Query Builder DBObject query = QueryBuilder.start( “price” ) .lessThan( 40.00 ) .and( “tag” ) .is( “java” ).get(); DBObject query = new BasicDBObject(); query.put( “tag”, “java” ); query.put( “price”, new BasicDBObject( “$lt”, 40.00 ) ); Thursday, November 29, 12
  • 34. Other JVM Languages Thursday, November 29, 12
  • 35. Jython • Allows Python’s clear syntax on the JVM • PyMongo uses native python code and has no hooks into the Java driver • Some care needed to ensure cursors are closed due to different garbage collection models. Thursday, November 29, 12
  • 36. JRuby • Support for JRuby 1.6.x and 1.7.x • Native Java extensions are bundled in with the BSON gem. • Utilises the Java driver for improved BSON decoding and performance. Thursday, November 29, 12
  • 37. Clojure • Clojure - http://clojuremongodb.info/ Thursday, November 29, 12
  • 38. Scala Driver • Wraps the Java driver • Provide idiomatic Scala interface to MongoDB Thursday, November 29, 12
  • 40. Scala case class Book(id: ObjectId, author: String, isbn: String, price: Price, year: Int, tags: Seq[String], title: String, publisher: String, edition: Option[String]) { def toDBObject = MongoDBObject( "author" -> author, "_id" -> id, "isbn" -> isbn, "price" -> price.toDBObject, "publicationYear" -> year, "tags" -> tags, "title" -> title, "publisher" -> publisher, "edition" -> edition ) } Thursday, November 29, 12
  • 41. Scala val builder = MongoDBObject.newBuilder builder += "foo" -> "bar" builder += "x" -> 5 builder += "map" -> Map("spam" -> 8.2, "eggs" -> "bacon") val dbObj = builder.result Thursday, November 29, 12
  • 42. Scala val mongo: MongoCollection = MongoConnection()("bookstore")("books") Thursday, November 29, 12
  • 43. Scala val mongo: MongoCollection = MongoConnection()("bookstore")("books") def findAll() = for ( book <- mongo.find() ) yield new Book(book) findAll().foreach(b => println("<Book> " + b)) Thursday, November 29, 12
  • 44. Scala val mongo: MongoCollection = MongoConnection()("bookstore")("books") def findAll() = for ( book <- mongo.find() ) yield newBook(book) findAll().foreach(b => println("<Book> " + b)) val query: DBObject = ("price" $lt 40.00) ++ ("tag" -> "scala") Thursday, November 29, 12
  • 45. Other Scala Projects • Hammersmith - Netty + Akka.IO interfaces, strongly functional and callback based • ReactiveMongo - from the amazing team @ Zenexity who brought us the Play! Framework Thursday, November 29, 12
  • 48. Morphia @Entity("books") // MongoDB collection to use class Book { public Book () { } // ... } Thursday, November 29, 12
  • 49. Morphia @Entity("books") class Book { @Id private ObjectId id; public Book () { } // ... } Thursday, November 29, 12
  • 50. Morphia @Entity("books") class Book { @Id private ObjectId id; private List<String> tags = new ArrayList<String>(); public Book () { } // ... } Thursday, November 29, 12
  • 51. Morphia @Entity("books") class Book { @Id private ObjectId id; private List<String> tags = new ArrayList<String>(); @Embedded private Price price; public Book () { } // ... } @Embedded class Price { // ... } Thursday, November 29, 12
  • 52. Morphia @Entity("books") class Book { @Id private ObjectId id; private List<String> tags = new ArrayList<String>(); @Embedded private Price price; @Reference private Author author; public Book () { } // ... } @Entity("authors") class Author { // ... } Thursday, November 29, 12
  • 53. Morphia @Entity("books") class Book { @Id private ObjectId id; private List<String> tags = new ArrayList<String>(); @Embedded private Price price; @Reference private Author author; @Property("publicationYear") private int year; public Book () { } // ... } Thursday, November 29, 12
  • 55. Spring Data Document @Document(collection=“books”) public class Book { // ... } Thursday, November 29, 12
  • 56. Spring Data Document @Document(collection=“books”) public class Book { @Id private String id; } Thursday, November 29, 12
  • 57. Spring Data Document @Document(collection=“books”) public class Book { @Id private String id; private List<String> tags = new ArrayList<String>(); private Price price; } Thursday, November 29, 12
  • 58. Spring Data Document @Document(collection=“books”) public class Book { @Id private String id; private List<String> tags = new ArrayList<String>(); private Price price; @DBRef private Author author; } Thursday, November 29, 12
  • 59. Spring Data Document @Document(collection=“books”) public class Book { @Id private String id; private List<String> tags = new ArrayList<String>(); private Price price; @DBRef private Author author; @Field("publicationYear") private int year; } Thursday, November 29, 12
  • 60. Spring Data Configuration <?xml version="1.0" encoding="UTF-8"?> <beans ... xmlns:mongo="http://www.springframework.org/schema/data/mongo" xsi:schemaLocation=" ... http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd"> <mongo:mongo id="mongo" > <mongo:options auto-connect-retry="true" /> </mongo:mongo> <bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate"> <constructor-arg ref="mongo" /> <constructor-arg value="news" /> </bean> <mongo:repositories base-package="org.mongodb.news.repositories"/> </beans> Thursday, November 29, 12
  • 61. Spring Data - Connecting ApplicationContext ctx = new ClassPathXmlApplicationContext( "spring-context.xml"); MongoOperations ops = ctx.getBean("mongoTemplate", MongoOperations.class); Thursday, November 29, 12
  • 62. Spring Data - Inserting ApplicationContext ctx = new ClassPathXmlApplicationContext( "spring-context.xml"); MongoOperations ops = ctx.getBean("mongoTemplate", MongoOperations.class); Book book = new Book(); // set fields on the book // ... ops.insert(book); Thursday, November 29, 12
  • 63. Spring Data - Querying MongoOperations ops = ctx.getBean("mongoTemplate", MongoOperations.class); Book book = ops.findOne(query(where("price").lt(40)), Book.class); Thursday, November 29, 12
  • 64. Spring Data - Querying MongoOperations ops = ctx.getBean("mongoTemplate", MongoOperations.class); Book book = ops.findOne(query(where("price").lt(40)), Book.class); book = ops.findById(book.getId(), Book.class); Thursday, November 29, 12
  • 65. Spring Data - Querying ApplicationContext ctx = new ClassPathXmlApplicationContext( "spring-context.xml"); BookRepository repo = ctx.getBean("bookRepository", BookRepository.class); Thursday, November 29, 12
  • 66. Spring Data - Querying ApplicationContext ctx = new ClassPathXmlApplicationContext( "spring-context.xml"); BookRepository repo = ctx.getBean("bookRepository", BookRepository.class); Book book = repo.findByAuthor("Eric"); Thursday, November 29, 12
  • 67. Spring Data - Querying public interface BookRepository extends CrudRepository<Book, String> { public Book findByAuthor(String author); } Thursday, November 29, 12
  • 68. Spring Data Configuration <?xml version="1.0" encoding="UTF-8"?> <beans ... xmlns:mongo="http://www.springframework.org/schema/data/mongo" xsi:schemaLocation=" ... http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd"> <mongo:mongo id="mongo" > <mongo:options auto-connect-retry="true" /> </mongo:mongo> <bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate"> <constructor-arg ref="mongo" /> <constructor-arg value="news" /> </bean> <mongo:repositories base-package="org.mongodb.news.repositories"/> </beans> Thursday, November 29, 12
  • 69. In Summary • MongoDB is an agile, scalable NoSQL database • If you’re coding on the JVM you have many options for interacting with MongoDB •Multiple native drivers •Frameworks to simplify development Thursday, November 29, 12
  • 70. More Information Resource Location MongoDB Downloads www.mongodb.org/downloads Free Online Training education.10gen.com Webinars and Events www.10gen.com/events White Papers www.10gen.com/white-papers Customer Case Studies www.10gen.com/customers Presentations www.10gen.com/presentations Documentation docs.mongodb.org Additional Info info@10gen.com trisha.gee@10gen.com @trisha_gee Thursday, November 29, 12
  • 71. More Information • http://www.mongodb.org/display/DOCS/Drivers • http://code.google.com/p/morphia/ • http://www.springsource.org/spring-data/mongodb trisha.gee@10gen.com @trisha_gee Thursday, November 29, 12