SlideShare ist ein Scribd-Unternehmen logo
1 von 68
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Andere mochten auch

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
 

Andere mochten auch (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のアレをアレする
 

Ähnlich wie 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: My First MongoDB Application
Back to Basics: My First MongoDB ApplicationBack to Basics: My First MongoDB Application
Back to Basics: My First MongoDB ApplicationMongoDB
 
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
 
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
 

Ähnlich wie 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: My First MongoDB Application
Back to Basics: My First MongoDB ApplicationBack to Basics: My First MongoDB Application
Back to Basics: My First MongoDB Application
 
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
 
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
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
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
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 

Kürzlich hochgeladen (20)

Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
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
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 

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")