SlideShare a Scribd company logo
1 of 68
Download to read offline
Collection “product”:        Collection “order”:
{                            {
     "_id" : productId1,         "_id" : orderId,
     "name" : name1,             "user" : userInfo,
     "price" : price1,           "items" : [
     "desc" : description1           productId1,
},                                   productId2,
{                                    productId3
     "_id" : productId2,         ]
…                            }
Collection “product”:            Collection “order”:
{                                {
    "_id" : productId1,              "_id" : orderId,
    "name" : name1,                  "user" : userInfo,
    "price" : price1,                "items" : [
    "desc" : description1                productId1,
}                                        productId2,
{                                        productId3
> db.product.findOne(“_id”:productId1)
    "_id" : productId2,              ]
> db.product.findOne(“_id”:productId2)
…                                }
> db.product.findOne(“_id”:productId3)
Collection “order”:
{
    "_id" : orderId,
    "user" : userInfo,
    "items" : [
          {
              "_id" : productId1,
              "name" : name1,
              "price" : price1
          }, {
              "_id" : productId1,
              "name" : name1,
              "price" : price2
          },...
    ] }
Collection “order”:
{                                                     order
    "_id" : orderId,
    "user" : userInfo,
    "items" : [                      collection              name

          {                                 price    order
              "_id" : productId1,
              "name" : name1,       > db.order.find({ items :{

              "price" : price1         $elemMatch: { name: name1 }

          }, {                      } } )

              "_id" : productId1,
              "name" : name1,       > db.order.find({ items :{

              "price" : price2         $elemMatch: { price:{ $gt: 3000 } }

          },...                     } } )

    ] }
Collection “order”:                 Collection “performance_rating”:
{                                   {
    "_id" : orderId,                    "_id" : "employeeId",
    "user" : userInfo,                  "name" : "name",
    "items" : [                         "post" : "section chief",
          {                             "abilities" : {
              "_id" : productId1,           "skillA" : 20,
              "name" : name1,               "skillC" : 12,
              "price" : price1              "skillE" : 18,
          }, {                              "skillF" : 24,
              "_id" : productId1,           "skillG" : 23
              "name" : name1,           }
              "price" : price2      }
          },...
    ] }
Collection “order”:                  Collection “performance_rating”:
{                                    {
    "_id" : orderId,                     "_id" : "employeeId",
$elemMatch
    "user" : userInfo,                   "name" : "name",
    "items" : [                          "post" : "section chief",
          {                              "abilities" : {
              "_id" : productId1,            "skillA" : 20,
              "name" : name1,                "skillC" : 12,
              "price" : price1               "skillE" : 18,
          }, {                               "skillF" : 24,
              "_id" : productId1,            "skillG" : 23
              "name" : name1,            }         1
              "price" : price2       }
          },...                     ”abilities.skillA”
    ] }
Collection “blog”:
{                                  comment
    "_id" : blogId,
    "user" : userInfo,
    "tags" : [tag1, tag2, tag3] 16MB/document
    "comment": [{                        In-Place
             "_id" : commentId1,
             "user" : userInfo1,
             "contents" : contents1
          }, {
             "_id" : commentId2,
             "user" : userInfo2,
             "contents" : contents2
          },...
    ] }
Collection “comment”:
Collection “blog”:                   {
{                                         "_id" : commentId,
     "_id" : blogId,                      "user" : userInfo,
     "user" : userInfo,                  > "contents" : contents1,
                                           db.comment.insert({

     "tags" : [tag1, tag2, tag3]          “_id”:commentId5,
                                          "lastUpdate" : datetime,
     "comment" : [                        “user”:...
                                          ...
        commentId1,                  })
                                     },...
        commentId3,                  {
        commentId5                        "_id" : commentId5,
      ],...                               "user" : userInfo,
 },                                       "contents" : contents1,
> db.blog.update({“_id”:blogId},
 {                                        "lastUpdate" : datetime,
{$push: { “comment”: commentId5 }}
                                          ...
})
                                     }
> db.coll.stats()
{   ...
    #1

    "paddingFactor" : 1.4099999999940787,
    ...
}
Collection “access_history”:
{
    "_id" : pageId,                          “start”          6
    "start" : time,                        visitor
    "visits" : {
         "minutes" : [
                                        “minites”    []
            [num0, num1, ..., num59],
                                              (           )
            [num0, num1, ..., num59],
            [num0, num1, ..., num59],
                                            “minites”     ”hours”
            [num0, num1, ..., num59],
                                                     0
            [num0, num1, ..., num59],
            [num0, num1, ..., num59]
    ],
    "hours" : [num0, ..., num5] }
}
Collection “access_history”:
{
    "_id" : pageId,
    "start" : time,
    "visits" : {
         "minutes" : [
            [0,0, ..., 0],
            [0,0, ..., 0],
            [0,0, ..., 0],
            [0,0, ..., 0],
            [0,0, ..., 0],
            [0,0, ..., 0]
    ],
    "hours" : [0, ..., 0] }
}
Collection “access_history”:
{
    "_id" : pageId,
                               $inc
    "start" : time,
    "visits" : {
         "minutes" : [
            [0,0, ..., 0],
            [3,0, ..., 0],
                               > db.pages.update({
            [0,0, ..., 0],         "_id" : pageId,
            [0,0, ..., 0],         "start" : thisHour
                               },{
            [0,0, ..., 0],        "$inc": {"visits.minutes.1.0": 3}
            [0,0, ..., 0]      })
    ],
    "hours" : [0, ..., 0] }
}
> collection.insert(
   { "_id" : 123,
    /* other fields */,
    "garbage" : someLongString})
> collection.update(
                          insert   gabage
   { "_id": 123 },
   { $unset: { "garbage" : 1} })
#   :(       )

{
         "_id" : BinData(5,"iiOI5R6P+dbut19O1mS1lA=="),
         "reduce_id" : 0,
                                        _id = user_id
         "user_id" : 00000,                   + date
         "date" : 20110727,                   + timeMilliSec
                                              + action_type
         "action_type" : "a{Make}",
         "key_depth" : 1,                       _id

         "action_detail" : {                          Binary

                 "kakejiku" : 2,
                                         # Python
                 "kaizokunojyuu" : 1,    bson.Binary(
                 "matoryo-sika" : 1,        hashlib.md5(
                                               str(unique_id)
                 "syokudai" : 1             ).digest(),
         }                                  bson.binary.MD5_SUBTYPE
                                         )
}
{
    "_id" : id,
    "name" : username,
    "email" : email,
    "phone" : phone,
    "twitter" : username,
                                     ”fax”
    "facebook" : username,
    "linkedin" : username,
    "google+" : number,
    "street" : street
    "city" : city,
    "state" : state,
    "zip" : zip,             > db.profile.find({
    "fax" : number                “fax”: number
                               })
}
{
    "_id" : id,
    "name" : username,
    “online”: {
         "email" : email,
         "twitter" : username,
         ...
    },
    ”address”: {                       ”telephone”

         "street" : street
         "city" : city,
         ...
    },
    “telephone”: {
         "phone" : phone,        > db.profile.find({
         "fax" : number               “telephone.fax”: number
                                   })
}
# A           B                  C

> db.coll.find({“A”: a, “B”: b, “C”: c})
# C           B                  A

> db.coll.find({“C”: c, “B”: b, “A”: a})

# A      B                 C

> db.coll.find($or: [“A”: a, “B”: b, “C”: c])
# C      B                 A

> db.coll.find($or: [“C”: c, “B”: b, “A”: a])
C

A       A               A
                B               B




    C       C               C
                    A
            B               B
C       C       C
                A
            B       B




                    C

A       A       A
            B       B
> db.coll.ensureIndex({ A: 1 })
> db.coll.ensureIndex({ B: 1 })
> db.coll.ensureIndex({ C: 1 })
# find   2   “Select A,B,C”

> db.coll.find({ A: a, B: b, C: c },
               { _id: -1, A: 1, B: 1, C: 1 })

                                          (_id
         )                Covered Index
journaling


         :buildIndexes=false


 ReplicaSet             3
                  AWS
Single Instance
Slave Delay




              1
journaling
Micro Instance


 Small Instance
 32bit
 Large Instance


        Arbiter


Small
$ ls /dbpath/rollback
dbname.collname.2011-08-14T18-27-14.0.bson
$ bsondump dbname.collname.2011-08-14T18-27-14.0.bson
 { "_id" : ... }
 { "_id" : ... }
 { "_id" : ... }
 Wed Aug 15 13:33:32      3 objects found
DC1      P
DC1                   S   P
      DC2
       Master
                DC2
> db.collname.insert({_id:...})
#
> db.getLastError()
# or
> db.runCommand("getlasterror")
> db.runCommand({ getlasterror: 1, fsync: true })
{ "err" : null, "n" : 0, "fsyncFiles" : 2, "ok" : 1 }




> db.runCommand({ getlasterror: 1, j: true })
> db.getLastError(2, 5000) // w=2, timeout 5000ms




> db.getLastError("majority")
Advanced MongoDB #1
Advanced MongoDB #1
Advanced MongoDB #1
Advanced MongoDB #1
Advanced MongoDB #1
Advanced MongoDB #1
Advanced MongoDB #1

More Related Content

What's hot

JavaScript Objects and OOP Programming with JavaScript
JavaScript Objects and OOP Programming with JavaScriptJavaScript Objects and OOP Programming with JavaScript
JavaScript Objects and OOP Programming with JavaScriptLaurence Svekis ✔
 
MongoDB .local Munich 2019: Tips and Tricks++ for Querying and Indexing MongoDB
MongoDB .local Munich 2019: Tips and Tricks++ for Querying and Indexing MongoDBMongoDB .local Munich 2019: Tips and Tricks++ for Querying and Indexing MongoDB
MongoDB .local Munich 2019: Tips and Tricks++ for Querying and Indexing MongoDBMongoDB
 
Dojo >= 1.7 Kickstart
Dojo >= 1.7  KickstartDojo >= 1.7  Kickstart
Dojo >= 1.7 KickstartHazem Saleh
 
Desarrollo de módulos en Drupal e integración con dispositivos móviles
Desarrollo de módulos en Drupal e integración con dispositivos móvilesDesarrollo de módulos en Drupal e integración con dispositivos móviles
Desarrollo de módulos en Drupal e integración con dispositivos móvilesLuis Curo Salvatierra
 
Schema Design
Schema DesignSchema Design
Schema DesignMongoDB
 
MongoDB .local London 2019: Tips and Tricks++ for Querying and Indexing MongoDB
MongoDB .local London 2019: Tips and Tricks++ for Querying and Indexing MongoDBMongoDB .local London 2019: Tips and Tricks++ for Querying and Indexing MongoDB
MongoDB .local London 2019: Tips and Tricks++ for Querying and Indexing MongoDBMongoDB
 
Ruby Development and MongoMapper (John Nunemaker)
Ruby Development and MongoMapper (John Nunemaker)Ruby Development and MongoMapper (John Nunemaker)
Ruby Development and MongoMapper (John Nunemaker)MongoSF
 
Mongo db mug_2012-02-07
Mongo db mug_2012-02-07Mongo db mug_2012-02-07
Mongo db mug_2012-02-07Will Button
 
From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)Night Sailer
 
The Ring programming language version 1.5.1 book - Part 42 of 180
The Ring programming language version 1.5.1 book - Part 42 of 180The Ring programming language version 1.5.1 book - Part 42 of 180
The Ring programming language version 1.5.1 book - Part 42 of 180Mahmoud Samir Fayed
 
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and MingRapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and MingRick Copeland
 
Cleaner, Leaner, Meaner: Refactoring your jQuery
Cleaner, Leaner, Meaner: Refactoring your jQueryCleaner, Leaner, Meaner: Refactoring your jQuery
Cleaner, Leaner, Meaner: Refactoring your jQueryRebecca Murphey
 
Object oriented javascript
Object oriented javascriptObject oriented javascript
Object oriented javascriptShah Jalal
 
Couchbase Korea User Group 2nd Meetup #2
Couchbase Korea User Group 2nd Meetup #2Couchbase Korea User Group 2nd Meetup #2
Couchbase Korea User Group 2nd Meetup #2won min jang
 
Command-Oriented Architecture
Command-Oriented ArchitectureCommand-Oriented Architecture
Command-Oriented ArchitectureLuiz Messias
 
Building DSLs with Groovy
Building DSLs with GroovyBuilding DSLs with Groovy
Building DSLs with GroovySten Anderson
 
Kick start with j query
Kick start with j queryKick start with j query
Kick start with j queryMd. Ziaul Haq
 

What's hot (18)

JavaScript Objects and OOP Programming with JavaScript
JavaScript Objects and OOP Programming with JavaScriptJavaScript Objects and OOP Programming with JavaScript
JavaScript Objects and OOP Programming with JavaScript
 
MongoDB .local Munich 2019: Tips and Tricks++ for Querying and Indexing MongoDB
MongoDB .local Munich 2019: Tips and Tricks++ for Querying and Indexing MongoDBMongoDB .local Munich 2019: Tips and Tricks++ for Querying and Indexing MongoDB
MongoDB .local Munich 2019: Tips and Tricks++ for Querying and Indexing MongoDB
 
Dojo >= 1.7 Kickstart
Dojo >= 1.7  KickstartDojo >= 1.7  Kickstart
Dojo >= 1.7 Kickstart
 
Desarrollo de módulos en Drupal e integración con dispositivos móviles
Desarrollo de módulos en Drupal e integración con dispositivos móvilesDesarrollo de módulos en Drupal e integración con dispositivos móviles
Desarrollo de módulos en Drupal e integración con dispositivos móviles
 
Schema Design
Schema DesignSchema Design
Schema Design
 
MongoDB .local London 2019: Tips and Tricks++ for Querying and Indexing MongoDB
MongoDB .local London 2019: Tips and Tricks++ for Querying and Indexing MongoDBMongoDB .local London 2019: Tips and Tricks++ for Querying and Indexing MongoDB
MongoDB .local London 2019: Tips and Tricks++ for Querying and Indexing MongoDB
 
Ruby Development and MongoMapper (John Nunemaker)
Ruby Development and MongoMapper (John Nunemaker)Ruby Development and MongoMapper (John Nunemaker)
Ruby Development and MongoMapper (John Nunemaker)
 
Mongo db mug_2012-02-07
Mongo db mug_2012-02-07Mongo db mug_2012-02-07
Mongo db mug_2012-02-07
 
From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)
 
The Ring programming language version 1.5.1 book - Part 42 of 180
The Ring programming language version 1.5.1 book - Part 42 of 180The Ring programming language version 1.5.1 book - Part 42 of 180
The Ring programming language version 1.5.1 book - Part 42 of 180
 
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and MingRapid and Scalable Development with MongoDB, PyMongo, and Ming
Rapid and Scalable Development with MongoDB, PyMongo, and Ming
 
Cleaner, Leaner, Meaner: Refactoring your jQuery
Cleaner, Leaner, Meaner: Refactoring your jQueryCleaner, Leaner, Meaner: Refactoring your jQuery
Cleaner, Leaner, Meaner: Refactoring your jQuery
 
Object oriented javascript
Object oriented javascriptObject oriented javascript
Object oriented javascript
 
Couchbase Korea User Group 2nd Meetup #2
Couchbase Korea User Group 2nd Meetup #2Couchbase Korea User Group 2nd Meetup #2
Couchbase Korea User Group 2nd Meetup #2
 
Command-Oriented Architecture
Command-Oriented ArchitectureCommand-Oriented Architecture
Command-Oriented Architecture
 
Building DSLs with Groovy
Building DSLs with GroovyBuilding DSLs with Groovy
Building DSLs with Groovy
 
Kick start with j query
Kick start with j queryKick start with j query
Kick start with j query
 
Mongo db presentation
Mongo db presentationMongo db presentation
Mongo db presentation
 

Viewers also liked

MongoDBが遅いときの切り分け方法
MongoDBが遅いときの切り分け方法MongoDBが遅いときの切り分け方法
MongoDBが遅いときの切り分け方法Tetsutaro Watanabe
 
ソーシャルゲームにおけるMongoDB適用事例 - Animal Land
ソーシャルゲームにおけるMongoDB適用事例 - Animal LandソーシャルゲームにおけるMongoDB適用事例 - Animal Land
ソーシャルゲームにおけるMongoDB適用事例 - Animal LandMasakazu Matsushita
 
MongoDB on EC2 #mongodbcasual
MongoDB on EC2 #mongodbcasualMongoDB on EC2 #mongodbcasual
MongoDB on EC2 #mongodbcasualYasuhiro Matsuo
 
日本語:Mongo dbに於けるシャーディングについて
日本語:Mongo dbに於けるシャーディングについて日本語:Mongo dbに於けるシャーディングについて
日本語:Mongo dbに於けるシャーディングについてippei_suzuki
 
Mongo dbを知ろう devlove関西
Mongo dbを知ろう   devlove関西Mongo dbを知ろう   devlove関西
Mongo dbを知ろう devlove関西Ryuji Tamagawa
 
カジュアルにソースコードリーディング
カジュアルにソースコードリーディングカジュアルにソースコードリーディング
カジュアルにソースコードリーディングAkihiro Okuno
 
CasualなMongoDBのサービス運用Tips
CasualなMongoDBのサービス運用TipsCasualなMongoDBのサービス運用Tips
CasualなMongoDBのサービス運用TipsNaoki Sega
 
Casual Compression on MongoDB
Casual Compression on MongoDBCasual Compression on MongoDB
Casual Compression on MongoDBmoai kids
 
MongoDBではじめるカジュアルなタイムラインシステム
MongoDBではじめるカジュアルなタイムラインシステムMongoDBではじめるカジュアルなタイムラインシステム
MongoDBではじめるカジュアルなタイムラインシステムHitoshi Asai
 
カジュアルにMongo dbのbackup機能説明
カジュアルにMongo dbのbackup機能説明カジュアルにMongo dbのbackup機能説明
カジュアルにMongo dbのbackup機能説明Masakazu Matsushita
 
Mongo dbを知ろう
Mongo dbを知ろうMongo dbを知ろう
Mongo dbを知ろうCROOZ, inc.
 
MongoDB〜その性質と利用場面〜
MongoDB〜その性質と利用場面〜MongoDB〜その性質と利用場面〜
MongoDB〜その性質と利用場面〜Naruhiko Ogasawara
 
MongoDBのアレをアレする
MongoDBのアレをアレするMongoDBのアレをアレする
MongoDBのアレをアレするAkihiro Kuwano
 

Viewers also liked (14)

MongoDBが遅いときの切り分け方法
MongoDBが遅いときの切り分け方法MongoDBが遅いときの切り分け方法
MongoDBが遅いときの切り分け方法
 
Mongodb 紹介
Mongodb 紹介Mongodb 紹介
Mongodb 紹介
 
ソーシャルゲームにおけるMongoDB適用事例 - Animal Land
ソーシャルゲームにおけるMongoDB適用事例 - Animal LandソーシャルゲームにおけるMongoDB適用事例 - Animal Land
ソーシャルゲームにおけるMongoDB適用事例 - Animal Land
 
MongoDB on EC2 #mongodbcasual
MongoDB on EC2 #mongodbcasualMongoDB on EC2 #mongodbcasual
MongoDB on EC2 #mongodbcasual
 
日本語:Mongo dbに於けるシャーディングについて
日本語:Mongo dbに於けるシャーディングについて日本語:Mongo dbに於けるシャーディングについて
日本語:Mongo dbに於けるシャーディングについて
 
Mongo dbを知ろう devlove関西
Mongo dbを知ろう   devlove関西Mongo dbを知ろう   devlove関西
Mongo dbを知ろう devlove関西
 
カジュアルにソースコードリーディング
カジュアルにソースコードリーディングカジュアルにソースコードリーディング
カジュアルにソースコードリーディング
 
CasualなMongoDBのサービス運用Tips
CasualなMongoDBのサービス運用TipsCasualなMongoDBのサービス運用Tips
CasualなMongoDBのサービス運用Tips
 
Casual Compression on MongoDB
Casual Compression on MongoDBCasual Compression on MongoDB
Casual Compression on MongoDB
 
MongoDBではじめるカジュアルなタイムラインシステム
MongoDBではじめるカジュアルなタイムラインシステムMongoDBではじめるカジュアルなタイムラインシステム
MongoDBではじめるカジュアルなタイムラインシステム
 
カジュアルにMongo dbのbackup機能説明
カジュアルにMongo dbのbackup機能説明カジュアルにMongo dbのbackup機能説明
カジュアルにMongo dbのbackup機能説明
 
Mongo dbを知ろう
Mongo dbを知ろうMongo dbを知ろう
Mongo dbを知ろう
 
MongoDB〜その性質と利用場面〜
MongoDB〜その性質と利用場面〜MongoDB〜その性質と利用場面〜
MongoDB〜その性質と利用場面〜
 
MongoDBのアレをアレする
MongoDBのアレをアレするMongoDBのアレをアレする
MongoDBのアレをアレする
 

Similar to Advanced MongoDB #1

Modern Application Foundations: Underscore and Twitter Bootstrap
Modern Application Foundations: Underscore and Twitter BootstrapModern Application Foundations: Underscore and Twitter Bootstrap
Modern Application Foundations: Underscore and Twitter BootstrapHoward Lewis Ship
 
Webinar: Strongly Typed Languages and Flexible Schemas
Webinar: Strongly Typed Languages and Flexible SchemasWebinar: Strongly Typed Languages and Flexible Schemas
Webinar: Strongly Typed Languages and Flexible SchemasMongoDB
 
Webinar: Applikationsentwicklung mit MongoDB : Teil 5: Reporting & Aggregation
Webinar: Applikationsentwicklung mit MongoDB: Teil 5: Reporting & AggregationWebinar: Applikationsentwicklung mit MongoDB: Teil 5: Reporting & Aggregation
Webinar: Applikationsentwicklung mit MongoDB : Teil 5: Reporting & AggregationMongoDB
 
Your Entity, Your Code
Your Entity, Your CodeYour Entity, Your Code
Your Entity, Your CodeDrupalDay
 
Sencha Touch meets TYPO3
Sencha Touch meets TYPO3Sencha Touch meets TYPO3
Sencha Touch meets TYPO3Nils Dehl
 
MongoDB Performance Tuning
MongoDB Performance TuningMongoDB Performance Tuning
MongoDB Performance TuningMongoDB
 
Back to Basics 2017 - Your First MongoDB Application
Back to Basics 2017 - Your First MongoDB ApplicationBack to Basics 2017 - Your First MongoDB Application
Back to Basics 2017 - Your First MongoDB ApplicationJoe Drumgoole
 
Back to Basics: My First MongoDB Application
Back to Basics: My First MongoDB ApplicationBack to Basics: My First MongoDB Application
Back to Basics: My First MongoDB ApplicationMongoDB
 
MongoDB World 2018: Keynote
MongoDB World 2018: KeynoteMongoDB World 2018: Keynote
MongoDB World 2018: KeynoteMongoDB
 
Building a Scalable Inbox System with MongoDB and Java
Building a Scalable Inbox System with MongoDB and JavaBuilding a Scalable Inbox System with MongoDB and Java
Building a Scalable Inbox System with MongoDB and Javaantoinegirbal
 
1403 app dev series - session 5 - analytics
1403   app dev series - session 5 - analytics1403   app dev series - session 5 - analytics
1403 app dev series - session 5 - analyticsMongoDB
 
SFScon17 - Patrick Puecher: "Exploring data with Elasticsearch and Kibana"
SFScon17 - Patrick Puecher: "Exploring data with Elasticsearch and Kibana"SFScon17 - Patrick Puecher: "Exploring data with Elasticsearch and Kibana"
SFScon17 - Patrick Puecher: "Exploring data with Elasticsearch and Kibana"South Tyrol Free Software Conference
 
Strongly Typed Languages and Flexible Schemas
Strongly Typed Languages and Flexible SchemasStrongly Typed Languages and Flexible Schemas
Strongly Typed Languages and Flexible SchemasNorberto Leite
 
MongoDB Aggregation Framework in action !
MongoDB Aggregation Framework in action !MongoDB Aggregation Framework in action !
MongoDB Aggregation Framework in action !Sébastien Prunier
 
Query for json databases
Query for json databasesQuery for json databases
Query for json databasesBinh Le
 
MongoDB - Back to Basics - La tua prima Applicazione
MongoDB - Back to Basics - La tua prima ApplicazioneMongoDB - Back to Basics - La tua prima Applicazione
MongoDB - Back to Basics - La tua prima ApplicazioneMassimo Brignoli
 
Back to basics Italian webinar 2 Mia prima applicazione MongoDB
Back to basics Italian webinar 2  Mia prima applicazione MongoDBBack to basics Italian webinar 2  Mia prima applicazione MongoDB
Back to basics Italian webinar 2 Mia prima applicazione MongoDBMongoDB
 
Montreal Elasticsearch Meetup
Montreal Elasticsearch MeetupMontreal Elasticsearch Meetup
Montreal Elasticsearch MeetupLoïc Bertron
 

Similar to Advanced MongoDB #1 (20)

Modern Application Foundations: Underscore and Twitter Bootstrap
Modern Application Foundations: Underscore and Twitter BootstrapModern Application Foundations: Underscore and Twitter Bootstrap
Modern Application Foundations: Underscore and Twitter Bootstrap
 
Webinar: Strongly Typed Languages and Flexible Schemas
Webinar: Strongly Typed Languages and Flexible SchemasWebinar: Strongly Typed Languages and Flexible Schemas
Webinar: Strongly Typed Languages and Flexible Schemas
 
Build your own entity with Drupal
Build your own entity with DrupalBuild your own entity with Drupal
Build your own entity with Drupal
 
Webinar: Applikationsentwicklung mit MongoDB : Teil 5: Reporting & Aggregation
Webinar: Applikationsentwicklung mit MongoDB: Teil 5: Reporting & AggregationWebinar: Applikationsentwicklung mit MongoDB: Teil 5: Reporting & Aggregation
Webinar: Applikationsentwicklung mit MongoDB : Teil 5: Reporting & Aggregation
 
Your Entity, Your Code
Your Entity, Your CodeYour Entity, Your Code
Your Entity, Your Code
 
Your Entity, Your Code
Your Entity, Your CodeYour Entity, Your Code
Your Entity, Your Code
 
Sencha Touch meets TYPO3
Sencha Touch meets TYPO3Sencha Touch meets TYPO3
Sencha Touch meets TYPO3
 
MongoDB Performance Tuning
MongoDB Performance TuningMongoDB Performance Tuning
MongoDB Performance Tuning
 
Back to Basics 2017 - Your First MongoDB Application
Back to Basics 2017 - Your First MongoDB ApplicationBack to Basics 2017 - Your First MongoDB Application
Back to Basics 2017 - Your First MongoDB Application
 
Back to Basics: My First MongoDB Application
Back to Basics: My First MongoDB ApplicationBack to Basics: My First MongoDB Application
Back to Basics: My First MongoDB Application
 
MongoDB World 2018: Keynote
MongoDB World 2018: KeynoteMongoDB World 2018: Keynote
MongoDB World 2018: Keynote
 
Building a Scalable Inbox System with MongoDB and Java
Building a Scalable Inbox System with MongoDB and JavaBuilding a Scalable Inbox System with MongoDB and Java
Building a Scalable Inbox System with MongoDB and Java
 
1403 app dev series - session 5 - analytics
1403   app dev series - session 5 - analytics1403   app dev series - session 5 - analytics
1403 app dev series - session 5 - analytics
 
SFScon17 - Patrick Puecher: "Exploring data with Elasticsearch and Kibana"
SFScon17 - Patrick Puecher: "Exploring data with Elasticsearch and Kibana"SFScon17 - Patrick Puecher: "Exploring data with Elasticsearch and Kibana"
SFScon17 - Patrick Puecher: "Exploring data with Elasticsearch and Kibana"
 
Strongly Typed Languages and Flexible Schemas
Strongly Typed Languages and Flexible SchemasStrongly Typed Languages and Flexible Schemas
Strongly Typed Languages and Flexible Schemas
 
MongoDB Aggregation Framework in action !
MongoDB Aggregation Framework in action !MongoDB Aggregation Framework in action !
MongoDB Aggregation Framework in action !
 
Query for json databases
Query for json databasesQuery for json databases
Query for json databases
 
MongoDB - Back to Basics - La tua prima Applicazione
MongoDB - Back to Basics - La tua prima ApplicazioneMongoDB - Back to Basics - La tua prima Applicazione
MongoDB - Back to Basics - La tua prima Applicazione
 
Back to basics Italian webinar 2 Mia prima applicazione MongoDB
Back to basics Italian webinar 2  Mia prima applicazione MongoDBBack to basics Italian webinar 2  Mia prima applicazione MongoDB
Back to basics Italian webinar 2 Mia prima applicazione MongoDB
 
Montreal Elasticsearch Meetup
Montreal Elasticsearch MeetupMontreal Elasticsearch Meetup
Montreal Elasticsearch Meetup
 

More from Takahiro Inoue

Treasure Data × Wave Analytics EC Demo
Treasure Data × Wave Analytics EC DemoTreasure Data × Wave Analytics EC Demo
Treasure Data × Wave Analytics EC DemoTakahiro Inoue
 
トレジャーデータとtableau実現する自動レポーティング
トレジャーデータとtableau実現する自動レポーティングトレジャーデータとtableau実現する自動レポーティング
トレジャーデータとtableau実現する自動レポーティングTakahiro Inoue
 
Tableauが魅せる Data Visualization の世界
Tableauが魅せる Data Visualization の世界Tableauが魅せる Data Visualization の世界
Tableauが魅せる Data Visualization の世界Takahiro Inoue
 
トレジャーデータのバッチクエリとアドホッククエリを理解する
トレジャーデータのバッチクエリとアドホッククエリを理解するトレジャーデータのバッチクエリとアドホッククエリを理解する
トレジャーデータのバッチクエリとアドホッククエリを理解するTakahiro Inoue
 
20140708 オンラインゲームソリューション
20140708 オンラインゲームソリューション20140708 オンラインゲームソリューション
20140708 オンラインゲームソリューションTakahiro Inoue
 
トレジャーデータ流,データ分析の始め方
トレジャーデータ流,データ分析の始め方トレジャーデータ流,データ分析の始め方
トレジャーデータ流,データ分析の始め方Takahiro Inoue
 
オンラインゲームソリューション@トレジャーデータ
オンラインゲームソリューション@トレジャーデータオンラインゲームソリューション@トレジャーデータ
オンラインゲームソリューション@トレジャーデータTakahiro Inoue
 
事例で学ぶトレジャーデータ 20140612
事例で学ぶトレジャーデータ 20140612事例で学ぶトレジャーデータ 20140612
事例で学ぶトレジャーデータ 20140612Takahiro Inoue
 
トレジャーデータ株式会社について(for all Data_Enthusiast!!)
トレジャーデータ株式会社について(for all Data_Enthusiast!!)トレジャーデータ株式会社について(for all Data_Enthusiast!!)
トレジャーデータ株式会社について(for all Data_Enthusiast!!)Takahiro Inoue
 
この Visualization がすごい2014 〜データ世界を彩るツール6選〜
この Visualization がすごい2014 〜データ世界を彩るツール6選〜この Visualization がすごい2014 〜データ世界を彩るツール6選〜
この Visualization がすごい2014 〜データ世界を彩るツール6選〜Takahiro Inoue
 
Treasure Data Intro for Data Enthusiast!!
Treasure Data Intro for Data Enthusiast!!Treasure Data Intro for Data Enthusiast!!
Treasure Data Intro for Data Enthusiast!!Takahiro Inoue
 
Hadoop and the Data Scientist
Hadoop and the Data ScientistHadoop and the Data Scientist
Hadoop and the Data ScientistTakahiro Inoue
 
MongoDB: Intro & Application for Big Data
MongoDB: Intro & Application  for Big DataMongoDB: Intro & Application  for Big Data
MongoDB: Intro & Application for Big DataTakahiro Inoue
 
An Introduction to Fluent & MongoDB Plugins
An Introduction to Fluent & MongoDB PluginsAn Introduction to Fluent & MongoDB Plugins
An Introduction to Fluent & MongoDB PluginsTakahiro Inoue
 
An Introduction to Tinkerpop
An Introduction to TinkerpopAn Introduction to Tinkerpop
An Introduction to TinkerpopTakahiro Inoue
 
An Introduction to Neo4j
An Introduction to Neo4jAn Introduction to Neo4j
An Introduction to Neo4jTakahiro Inoue
 
The Definition of GraphDB
The Definition of GraphDBThe Definition of GraphDB
The Definition of GraphDBTakahiro Inoue
 
Large-Scale Graph Processing〜Introduction〜(完全版)
Large-Scale Graph Processing〜Introduction〜(完全版)Large-Scale Graph Processing〜Introduction〜(完全版)
Large-Scale Graph Processing〜Introduction〜(完全版)Takahiro Inoue
 
Large-Scale Graph Processing〜Introduction〜(LT版)
Large-Scale Graph Processing〜Introduction〜(LT版)Large-Scale Graph Processing〜Introduction〜(LT版)
Large-Scale Graph Processing〜Introduction〜(LT版)Takahiro Inoue
 
はじめてのGlusterFS
はじめてのGlusterFSはじめてのGlusterFS
はじめてのGlusterFSTakahiro Inoue
 

More from Takahiro Inoue (20)

Treasure Data × Wave Analytics EC Demo
Treasure Data × Wave Analytics EC DemoTreasure Data × Wave Analytics EC Demo
Treasure Data × Wave Analytics EC Demo
 
トレジャーデータとtableau実現する自動レポーティング
トレジャーデータとtableau実現する自動レポーティングトレジャーデータとtableau実現する自動レポーティング
トレジャーデータとtableau実現する自動レポーティング
 
Tableauが魅せる Data Visualization の世界
Tableauが魅せる Data Visualization の世界Tableauが魅せる Data Visualization の世界
Tableauが魅せる Data Visualization の世界
 
トレジャーデータのバッチクエリとアドホッククエリを理解する
トレジャーデータのバッチクエリとアドホッククエリを理解するトレジャーデータのバッチクエリとアドホッククエリを理解する
トレジャーデータのバッチクエリとアドホッククエリを理解する
 
20140708 オンラインゲームソリューション
20140708 オンラインゲームソリューション20140708 オンラインゲームソリューション
20140708 オンラインゲームソリューション
 
トレジャーデータ流,データ分析の始め方
トレジャーデータ流,データ分析の始め方トレジャーデータ流,データ分析の始め方
トレジャーデータ流,データ分析の始め方
 
オンラインゲームソリューション@トレジャーデータ
オンラインゲームソリューション@トレジャーデータオンラインゲームソリューション@トレジャーデータ
オンラインゲームソリューション@トレジャーデータ
 
事例で学ぶトレジャーデータ 20140612
事例で学ぶトレジャーデータ 20140612事例で学ぶトレジャーデータ 20140612
事例で学ぶトレジャーデータ 20140612
 
トレジャーデータ株式会社について(for all Data_Enthusiast!!)
トレジャーデータ株式会社について(for all Data_Enthusiast!!)トレジャーデータ株式会社について(for all Data_Enthusiast!!)
トレジャーデータ株式会社について(for all Data_Enthusiast!!)
 
この Visualization がすごい2014 〜データ世界を彩るツール6選〜
この Visualization がすごい2014 〜データ世界を彩るツール6選〜この Visualization がすごい2014 〜データ世界を彩るツール6選〜
この Visualization がすごい2014 〜データ世界を彩るツール6選〜
 
Treasure Data Intro for Data Enthusiast!!
Treasure Data Intro for Data Enthusiast!!Treasure Data Intro for Data Enthusiast!!
Treasure Data Intro for Data Enthusiast!!
 
Hadoop and the Data Scientist
Hadoop and the Data ScientistHadoop and the Data Scientist
Hadoop and the Data Scientist
 
MongoDB: Intro & Application for Big Data
MongoDB: Intro & Application  for Big DataMongoDB: Intro & Application  for Big Data
MongoDB: Intro & Application for Big Data
 
An Introduction to Fluent & MongoDB Plugins
An Introduction to Fluent & MongoDB PluginsAn Introduction to Fluent & MongoDB Plugins
An Introduction to Fluent & MongoDB Plugins
 
An Introduction to Tinkerpop
An Introduction to TinkerpopAn Introduction to Tinkerpop
An Introduction to Tinkerpop
 
An Introduction to Neo4j
An Introduction to Neo4jAn Introduction to Neo4j
An Introduction to Neo4j
 
The Definition of GraphDB
The Definition of GraphDBThe Definition of GraphDB
The Definition of GraphDB
 
Large-Scale Graph Processing〜Introduction〜(完全版)
Large-Scale Graph Processing〜Introduction〜(完全版)Large-Scale Graph Processing〜Introduction〜(完全版)
Large-Scale Graph Processing〜Introduction〜(完全版)
 
Large-Scale Graph Processing〜Introduction〜(LT版)
Large-Scale Graph Processing〜Introduction〜(LT版)Large-Scale Graph Processing〜Introduction〜(LT版)
Large-Scale Graph Processing〜Introduction〜(LT版)
 
はじめてのGlusterFS
はじめてのGlusterFSはじめてのGlusterFS
はじめてのGlusterFS
 

Recently uploaded

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
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 MenDelhi Call girls
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
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 Nanonetsnaman860154
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging 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 interpreternaman860154
 

Recently uploaded (20)

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
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
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
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
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
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
 

Advanced MongoDB #1

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9. Collection “product”: Collection “order”: { { "_id" : productId1, "_id" : orderId, "name" : name1, "user" : userInfo, "price" : price1, "items" : [ "desc" : description1 productId1, }, productId2, { productId3 "_id" : productId2, ] … }
  • 10. Collection “product”: Collection “order”: { { "_id" : productId1, "_id" : orderId, "name" : name1, "user" : userInfo, "price" : price1, "items" : [ "desc" : description1 productId1, } productId2, { productId3 > db.product.findOne(“_id”:productId1) "_id" : productId2, ] > db.product.findOne(“_id”:productId2) … } > db.product.findOne(“_id”:productId3)
  • 11. Collection “order”: { "_id" : orderId, "user" : userInfo, "items" : [ { "_id" : productId1, "name" : name1, "price" : price1 }, { "_id" : productId1, "name" : name1, "price" : price2 },... ] }
  • 12. Collection “order”: { order "_id" : orderId, "user" : userInfo, "items" : [ collection name { price order "_id" : productId1, "name" : name1, > db.order.find({ items :{ "price" : price1 $elemMatch: { name: name1 } }, { } } ) "_id" : productId1, "name" : name1, > db.order.find({ items :{ "price" : price2 $elemMatch: { price:{ $gt: 3000 } } },... } } ) ] }
  • 13. Collection “order”: Collection “performance_rating”: { { "_id" : orderId, "_id" : "employeeId", "user" : userInfo, "name" : "name", "items" : [ "post" : "section chief", { "abilities" : { "_id" : productId1, "skillA" : 20, "name" : name1, "skillC" : 12, "price" : price1 "skillE" : 18, }, { "skillF" : 24, "_id" : productId1, "skillG" : 23 "name" : name1, } "price" : price2 } },... ] }
  • 14. Collection “order”: Collection “performance_rating”: { { "_id" : orderId, "_id" : "employeeId", $elemMatch "user" : userInfo, "name" : "name", "items" : [ "post" : "section chief", { "abilities" : { "_id" : productId1, "skillA" : 20, "name" : name1, "skillC" : 12, "price" : price1 "skillE" : 18, }, { "skillF" : 24, "_id" : productId1, "skillG" : 23 "name" : name1, } 1 "price" : price2 } },... ”abilities.skillA” ] }
  • 15.
  • 16.
  • 17.
  • 18. Collection “blog”: { comment "_id" : blogId, "user" : userInfo, "tags" : [tag1, tag2, tag3] 16MB/document "comment": [{ In-Place "_id" : commentId1, "user" : userInfo1, "contents" : contents1 }, { "_id" : commentId2, "user" : userInfo2, "contents" : contents2 },... ] }
  • 19. Collection “comment”: Collection “blog”: { { "_id" : commentId, "_id" : blogId, "user" : userInfo, "user" : userInfo, > "contents" : contents1, db.comment.insert({ "tags" : [tag1, tag2, tag3] “_id”:commentId5, "lastUpdate" : datetime, "comment" : [ “user”:... ... commentId1, }) },... commentId3, { commentId5 "_id" : commentId5, ],... "user" : userInfo, }, "contents" : contents1, > db.blog.update({“_id”:blogId}, { "lastUpdate" : datetime, {$push: { “comment”: commentId5 }} ... }) }
  • 20.
  • 21. > db.coll.stats() { ... #1 "paddingFactor" : 1.4099999999940787, ... }
  • 22.
  • 23. Collection “access_history”: { "_id" : pageId, “start” 6 "start" : time, visitor "visits" : { "minutes" : [ “minites” [] [num0, num1, ..., num59], ( ) [num0, num1, ..., num59], [num0, num1, ..., num59], “minites” ”hours” [num0, num1, ..., num59], 0 [num0, num1, ..., num59], [num0, num1, ..., num59] ], "hours" : [num0, ..., num5] } }
  • 24. Collection “access_history”: { "_id" : pageId, "start" : time, "visits" : { "minutes" : [ [0,0, ..., 0], [0,0, ..., 0], [0,0, ..., 0], [0,0, ..., 0], [0,0, ..., 0], [0,0, ..., 0] ], "hours" : [0, ..., 0] } }
  • 25. Collection “access_history”: { "_id" : pageId, $inc "start" : time, "visits" : { "minutes" : [ [0,0, ..., 0], [3,0, ..., 0], > db.pages.update({ [0,0, ..., 0], "_id" : pageId, [0,0, ..., 0], "start" : thisHour },{ [0,0, ..., 0], "$inc": {"visits.minutes.1.0": 3} [0,0, ..., 0] }) ], "hours" : [0, ..., 0] } }
  • 26. > collection.insert( { "_id" : 123, /* other fields */, "garbage" : someLongString}) > collection.update( insert gabage { "_id": 123 }, { $unset: { "garbage" : 1} })
  • 27.
  • 28.
  • 29.
  • 30. # :( ) { "_id" : BinData(5,"iiOI5R6P+dbut19O1mS1lA=="), "reduce_id" : 0, _id = user_id "user_id" : 00000, + date "date" : 20110727, + timeMilliSec + action_type "action_type" : "a{Make}", "key_depth" : 1, _id "action_detail" : { Binary "kakejiku" : 2, # Python "kaizokunojyuu" : 1, bson.Binary( "matoryo-sika" : 1, hashlib.md5( str(unique_id) "syokudai" : 1 ).digest(), } bson.binary.MD5_SUBTYPE ) }
  • 31.
  • 32.
  • 33. { "_id" : id, "name" : username, "email" : email, "phone" : phone, "twitter" : username, ”fax” "facebook" : username, "linkedin" : username, "google+" : number, "street" : street "city" : city, "state" : state, "zip" : zip, > db.profile.find({ "fax" : number “fax”: number }) }
  • 34.
  • 35. { "_id" : id, "name" : username, “online”: { "email" : email, "twitter" : username, ... }, ”address”: { ”telephone” "street" : street "city" : city, ... }, “telephone”: { "phone" : phone, > db.profile.find({ "fax" : number “telephone.fax”: number }) }
  • 36.
  • 37.
  • 38. # A B C > db.coll.find({“A”: a, “B”: b, “C”: c}) # C B A > db.coll.find({“C”: c, “B”: b, “A”: a}) # A B C > db.coll.find($or: [“A”: a, “B”: b, “C”: c]) # C B A > db.coll.find($or: [“C”: c, “B”: b, “A”: a])
  • 39. C A A A B B C C C A B B
  • 40. C C C A B B C A A A B B
  • 41.
  • 42. > db.coll.ensureIndex({ A: 1 }) > db.coll.ensureIndex({ B: 1 }) > db.coll.ensureIndex({ C: 1 }) # find 2 “Select A,B,C” > db.coll.find({ A: a, B: b, C: c }, { _id: -1, A: 1, B: 1, C: 1 }) (_id ) Covered Index
  • 43.
  • 44.
  • 45.
  • 46.
  • 47. journaling :buildIndexes=false ReplicaSet 3 AWS Single Instance
  • 48. Slave Delay 1 journaling
  • 49. Micro Instance Small Instance 32bit Large Instance Arbiter Small
  • 50.
  • 51. $ ls /dbpath/rollback dbname.collname.2011-08-14T18-27-14.0.bson $ bsondump dbname.collname.2011-08-14T18-27-14.0.bson { "_id" : ... } { "_id" : ... } { "_id" : ... } Wed Aug 15 13:33:32 3 objects found
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57. DC1 P DC1 S P DC2 Master DC2
  • 58.
  • 59. > db.collname.insert({_id:...}) # > db.getLastError() # or > db.runCommand("getlasterror")
  • 60. > db.runCommand({ getlasterror: 1, fsync: true }) { "err" : null, "n" : 0, "fsyncFiles" : 2, "ok" : 1 } > db.runCommand({ getlasterror: 1, j: true })
  • 61. > db.getLastError(2, 5000) // w=2, timeout 5000ms > db.getLastError("majority")