SlideShare a Scribd company logo
{
    "_id" : <unspecified>, //file      ID
    "length" : data_number, //          bytes
    "chunkSize" : data_number, //               :256KB
    "uploadDate" : data_date, //file
    "md5" : data_string //"filemd5"
}
{
    "filename" : data_string,
    "contentType" : data_string,
    "aliases" : data_array of data_string,
    "metadata" : data_object,
}
{
    "_id" : <unspecified>, //chunk           ID

    "files_id" : <unspecified>, //file            _id

    "n" : chunk_number, //0          chunk

        0,1,2...   chunk

    "data" : data_binary, // BSON

}
> db.fs.chunks.ensureIndex(
                    {files_id:1, n:1}, {unique: true});




> db.fs.chunks.findOne({files_id: myFileID, n: 0});
➜ ~ mongofiles --help
usage: mongofiles [options] command [gridfs filename]
command:
  one of (list|search|put|get)
  list - file
 search - file
 put - file
 get - file
 delete - file
➜ ~ mongofiles list
connected to: 127.0.0.1

➜ ~ mongofiles put ByeForNow.mp3
connected to: 127.0.0.1
added file: { _id: ObjectId('4df17f8d9d47ba5c0247e72e'),
filename: "ByeForNow.mp3", chunkSize: 262144, uploadDate:
new Date(1307672462538), md5:
"9ee9472200a2e18bf376ce622c3b0055", length: 11183104 }
done!

➜   ~   mongofiles list -v // -v
Fri Jun 10 11:21:05 creating new connection to:127.0.0.1
Fri Jun 10 11:21:05 BackgroundJob starting:
connected to: 127.0.0.1
ByeForNow.mp3   11183104
➜ ~ mongofiles put Maria.mp3
connected to: 127.0.0.1
added file: { _id: ObjectId('4df181fc5e354129e833193f'),
filename: "Maria.mp3", chunkSize: 262144, uploadDate: new
Date(1307673086293), md5:
"9d4f424fa1843711e196e502d8a00183", length: 12225353 }
done!
➜ ~ mongofiles list
connected to: 127.0.0.1
ByeForNow.mp3   11183104
Maria.mp3       12225353
➜ ~ mongofiles list M
connected to: 127.0.0.1
Maria.mp3       12225353
➜ ~ mongofiles search .mp3
connected to: 127.0.0.1
ByeForNow.mp3   11183104
Maria.mp3       12225353
➜   ~   mkdir tmp //      get
➜ ~ cd tmp
➜ mongofiles get Maria.mp3
connected to: 127.0.0.1
done write to: Maria.mp3
➜ ls
Maria.mp3
➜ mongofiles get Bye
ERROR: file not found
➜ mongofiles get ByeForNow.mp3
done write to: ByeForNow.mp3
➜ md5 Maria.mp3
MD5 (Maria.mp3) = 9d4f424fa1843711e196e502d8a00183
➜ md5 ../Maria.mp3
MD5 (../Maria.mp3) = 9d4f424fa1843711e196e502d8a00183
> db.fs.files.find().forEach(printjson)
{
        "_id" : ObjectId("4df17f8d9d47ba5c0247e72e"),
        "filename" : "ByeForNow.mp3",
        "chunkSize" : 262144,
        "uploadDate" : ISODate("2011-06-10T02:21:02.538Z"),
        "md5" : "9ee9472200a2e18bf376ce622c3b0055",
        "length" : 11183104
}
{
        "_id" : ObjectId("4df181fc5e354129e833193f"),
        "filename" : "Maria.mp3",
        "chunkSize" : 262144,
        "uploadDate" : ISODate("2011-06-10T02:31:26.293Z"),
        "md5" : "9d4f424fa1843711e196e502d8a00183",
        "length" : 12225353
}
> db.fs.chunks.findOne(
     {n:0,files_id:ObjectId("4df181fc5e354129e833193f")})
{
  "_id" : ObjectId("4df181fcd40994ca1de28d09"),
  "files_id" : ObjectId("4df181fc5e354129e833193f"),
  "n" : 0,
  "data" : BinData(0,"SUQzAwAAAABQdlRSQ0sAAAACAAAAM1RJVDIA
AAAHAAAAg32DioNBVUZJRAAAAGYAAGh0dHA6Ly93d3cuY2RkYi5jb20vaWQ
zL3RhZ2luZm8xLmh0bWwAM0NEM00xMTBRMjA3NTYwOTc4VjY4MTBCQTlBNj
UzN0JCQUQ1QTgyOUE4NTRCRkQ2QTdBRjNQOAAAAAAAAAAAAEdFT0IAACNgA
AAAYXBwbGljYX...)
}
>   db.fs.chunks.ensureIndex({files_id: 1});
>   db.runCommand({ shardcollection : "test.fs.chunks", key :
{   files_id : 1 }})
{   "collectionsharded" : "test.fs.chunks", "ok" : 1 }
MongoDB   GridFS
Replace Amazon S3 with MongoDB GridFS and Grails
{   loc   :   [   50 , 30 ] }
{   loc   :   {   x : 50 , y : 30 } }
{   loc   :   {   foo : 50 , y : 30 } }
{   loc   :   {   long : 40.739037, lat: 73.992964 } }
db.places.ensureIndex( { loc : "2d" } )
db.places.ensureIndex( { loc : "2d" } , { min : -500 , max : 500 } )
db.places.find( { loc : [50,50] } )




db.places.find( { loc : { $near : [50,50] } } )
db.places.find( { loc : { $near : [50,50] } } ).limit(20)
db.places.find( { loc : { $near : [50,50] ,
                          $maxDistance : 5 } } ).limit(20)
//
> box = [[40.73083, -73.99756], [40.741404, -73.988135]]
> db.places.find({"loc" : {"$within" : {"$box" : box}}})

//
> center = [50, 50]
> radius = 10
> db.places.find({"loc" : {"$within" : {"$center" : [center, radius]}}})

// v1.9
> polygonA = [ [ 10, 20 ], [   10, 40 ], [ 30, 40 ], [ 30, 20 ] ]
> polygonB = { a : { x : 10,   y : 20 }, b : { x : 15, y : 25 }, c : { x :
20, y : 20 } }
> db.places.find({ "loc" : {   "$within" : { "$polygon" : polygonA } } })
> db.places.find({ "loc" : {   "$within" : { "$polygon" : polygonB } } })
> db.runCommand( { geoNear : "places" , near : [ 50 , 50 ], num : 10,
query : { type : "museum" } } );
{
       "ns" : "test.places",
       "near" : "1100110000001111110000001111110000001111110000001111",
       "results" : [
               {
                       "dis" : 69.29646421910687,
                       "obj" : {
                               "_id" : ObjectId("4b8bd6b93b83c574d8760280"),
                               "y" : [
                                       1,
                                       1
                               ],
                               "category" : "Coffee"
                       }
               },
               {
                       "dis" : 69.29646421910687,
                       "obj" : {
                               "_id" : ObjectId("4b8bd6b03b83c574d876027f"),
                                       1
...}
MongoDB
> db.points.insert({ pos : { long : 30, lat : 30 } })
> db.points.insert({ pos : { long : -10, lat : -20 } })
> db.points.ensureIndex({ pos : "2d" })

> db.points.find({ pos: { $nearSphere: [0,0], $maxDistance : 0.4 } })
{ "_id" : ObjectId("4df11e47b8e84370f84afdd3"), "pos" : { "long" : -10,
"lat" : -20 } }
> var earthRadius = 6378 // km
> var range = 3000 // km
> distances = db.runCommand({ geoNear : "points", near : [0, 0], spherical :
true, maxDistance : range / earthRadius }).results
[
        {
                "dis" : 0.3886630122897946, //
                "obj" : {
                        "_id" : ObjectId("4df11e47b8e84370f84afdd3"),
                        "pos" : {
                                "long" : -10,
                                "lat" : -20
                        }
                }
        }
]
> pointDistance = distances[0].dis * earthRadius
2478.89269238431 // km
http://www.slideshare.net/doryokujin/mongo-sharding
~   mkdir    -p   shard/shard00
~   mkdir    -p   shard/shard01
~   mkdir    -p   shard/shard02
~   mkdir    -p   shard/config




~   mongod   --shardsvr --port 27017 --dbpath    shard/shard00
~   mongod   --shardsvr --port 27018 --dbpath    shard/shard01
~   mongod   --shardsvr --port 27019 --dbpath    shard/shard02
~   mongod   --configsvr --port 27020 --dbpath   shard/config
~   mongos   --configdb localhost:27020 --port   27021
➜   ~    mongo localhost:27021 // mongos

MongoDB shell version: 1.8.0
connecting to: localhost:27021/test
> show dbs
config    0.1875GB // sharding

> db.adminCommand( { addshard: "localhost:27017", name: "shard00" } )
{ "shardAdded" : "shard00", "ok" : 1 }
> db.adminCommand( { addshard: "localhost:27018", name: "shard01" } )
{ "shardAdded" : "shard01", "ok" : 1 }
> db.adminCommand( { addshard: "localhost:27019", name: "shard02" } )
{ "shardAdded" : "shard02", "ok" : 1 }
//       mongos

> db.adminCommand( { enablesharding : "test" } )
{ "ok" : 1 }
> db.adminCommand( { moveprimary : "test", to : "shard02" } );
{ "primary " : "shard02:localhost:27019", "ok" : 1 }
> db.adminCommand( { shardcollection : "test.myshard", key : { n : 1 } } )
{ "collectionsharded" : "test.myshard", "ok" : 1 }
//       mongos

> db.adminCommand({split : "test.myshard", middle : { n: 0 } } )
{ "ok" : 1 }
> db.adminCommand({split : "test.myshard", middle : { n: 1 } } )
{ "ok" : 1 }
> db.adminCommand({split : "test.myshard", middle : { n: 2 } } )
{ "ok" : 1 }
> db.printShardingStatus() //

--- Sharding Status ---
  sharding version: { "_id" : 1, "version" : 3 }
  shards:
      { "_id" : "shard00", "host" : "localhost:27017" }
      { "_id" : "shard01", "host" : "localhost:27018" }
      { "_id" : "shard02", "host" : "localhost:27019" }
  databases:
        { "_id" : "admin", "partitioned" : false, "primary" : "config" }
        { "_id" : "test", "partitioned" : true, "primary" : "shard02" }
        test.myshard chunks:
            shard02 4
 { "n" : { $minKey : 1 } } -->> { "n" : 0 } on : shard02 { "t" : 1000, "i" : 1 }
 { "n" : 0 } -->> { "n" : 1 } on : shard02 { "t" : 1000, "i" : 3 }
 { "n" : 1 } -->> { "n" : 2 } on : shard02 { "t" : 1000, "i" : 5 }
 { "n" : 2 } -->> { "n" : { $maxKey : 1 } } on : shard02 { "t" : 1000, "i" : 6 }
//       mongos

> db.adminCommand({moveChunk: "test.myshard", find: { n: 0 }, to: "shard00" });
{ "millis" : 1051, "ok" : 1 }
> db.adminCommand({moveChunk: "test.myshard", find: { n: 1 }, to: "shard01" });
{ "millis" : 1046, "ok" : 1 }
> db.adminCommand({moveChunk :"test.myshard", find: { n: 2 }, to: "shard02" });
{ "ok" : 0, "errmsg" : "that chunk is already on that shard" }
> db.printShardingStatus()
--- Sharding Status ---
  sharding version: { "_id" : 1, "version" : 3 }
  shards:
      { "_id" : "shard00", "host" : "localhost:27017" }
      { "_id" : "shard01", "host" : "localhost:27018" }
      { "_id" : "shard02", "host" : "localhost:27019" }
  databases:
        { "_id" : "admin", "partitioned" : false, "primary" : "config" }
        { "_id" : "test", "partitioned" : true, "primary" : "shard02" }
        test.myshard chunks:
               shard02 2
               shard00 1
               shard01 1
   { "n" : { $minKey : 1 } } -->> { "n" : 0 } on : shard02 { "t" : 3000, "i" : 1 }
   { "n" : 0 } -->> { "n" : 1 } on : shard00 { "t" : 2000, "i" : 0 }
   { "n" : 1 } -->> { "n" : 2 } on : shard01 { "t" : 3000, "i" : 0 }
   { "n" : 2 } -->> { "n" : { $maxKey : 1 } } on : shard02 { "t" : 1000, "i" : 6 }
//         mongos

> for(var m=0; m<100; m++){ db.myshard.insert({n: m % 3}) } // n =0,1,2,0,1,...


> printShardingSizes()      // Shard

     ...
     test.myshard chunks:
     { "n" : { $minKey : 1 } } -->> { "n" : 0 } on : shard02 { "estimate" :
false, "size" : 0, "numObjects" : 0 }
     { "n" : 0 } -->> { "n" : 1 } on : shard00 { "estimate" : false, "size" :
1224, "numObjects" : 34 }
     { "n" : 1 } -->> { "n" : 2 } on : shard01 { "estimate" : false, "size" :
1188, "numObjects" : 33 }
     { "n" : 2 } -->> { "n" : { $maxKey : 1 } } on : shard02 { "estimate" :
false, "size" : 1188, "numObjects" : 33 }
➜    ~   mongo localhost:27017
> db.myshard.count()
34
> db.myshard.distinct("n")
[ 0 ]
➜    ~   mongo localhost:27018
> db.myshard.count()
33
> db.myshard.distinct("n")
[ 1 ]
➜    ~   mongo localhost:27019
> db.myshard.count()
33
> db.myshard.distinct("n")
[ 2 ]
> db.adminCommand( { addshard: "set00/delta1:27017,delta2:27017", name:
"shard00" } )
{ "shardAdded" : "shard00", "ok" : 1 }
> db.adminCommand( { addshard: "set01/delta3:27018,delta4:27018", name:
"shard01" } )
{ "shardAdded" : "shard01", "ok" : 1 }
> db.adminCommand( { addshard: "set02/delta5:27019,delta6:27019", name:
"shard02" } )
{ "shardAdded" : "shard02", "ok" : 1 }
Map-Reduce on Mongo
db.mycoll.mapReduce(
 map : <map                >,

 reduce : <reduce                >

 [, finalize : <finalize             >]

 [, query : <                        >]

 [, sort : <

     reduce                                       >]

 [, out : <                     >]

 [, scope : <object where fields go into javascript global scope >]

);
db.people.insert({userId:1,   age:24, type:"A"})
db.people.insert({userId:2,   age:47, type:"B"})
db.people.insert({userId:3,   age:34, type:"C"})
db.people.insert({userId:4,   age:4,   type:"B"})
db.people.insert({userId:5,   age:14, type:"A"})
db.people.insert({userId:6,   age:29, type:"C"})
db.people.insert({userId:7,   age:39, type:"C"})
db.people.insert({userId:8,   age:42, type:"B"})
db.people.insert({userId:9,   age:56, type:"A"})
db.people.insert({userId:10, age:12, type:"A"})
m = function() {
  emit(this.type, { age: this.age, num: 1 } );
}
r = function(key, values) {
    var result = { age: 0, num: 0 };
    values.forEach( function(value){
        result.age += value.age; // age
        result.num += value.num; //
    } );
    return result;
}
r = function(key, values) {
    var num = 0;
    var sum = 0;
    values.forEach( function(value){
        sum += value.age; // age
        num += value.num; //
    } );
    return sum/num;
}
m = function() {
  emit(this.type, { age: this.age, num: 1 } );
}
r = function(key, values) {
    var result = { age: 0, num: 0 };
    values.forEach( function(value){
        result.age += value.age; // age
        result.num += value.num; //
    } );
    return result;
}
m = function() {
  emit(this.type, { age: this.age, num: 1 } );
}
r = function(key, values) {
    var result = { age: 0, num: 0 };
    values.forEach( function(value){
        result.age += value.age; //
        result.num += value.num; //
    } );
    return result;
}
f = function( key, result ){
    result.avg = result.age / result.num;
    return result;
}
> res = db.people.mapReduce( m , r ,
        { finalize : f , out : "mr_out", verbose: true });
{
        "result" : "mr_out", //
        "timeMillis" : 18,     //
        "timing" : {
                "mapTime" : NumberLong(1),
                "emitLoop" : 12,
                "total" : 18
        },
        "counts" : {
                "input" : 10, // 10
                "emit" : 10,        // 10   emit
                "output" : 3        // 3
        },
        "ok" : 1,
}
> db.mr_out.find()
{ "_id" : "A",
  "value" : { "age" : 106, "num" : 4, "avg" : 26.5 } }
{ "_id" : "B",
  "value" : { "age" : 93, "num" : 3, "avg" : 31 } }
{ "_id" : "C",
  "value" : { "age" : 102, "num" : 3, "avg" : 34 } }
> res = db.people.mapReduce( m , r ,
  { finalize : f , out : "mr_out", query: { age: { $gte: 20 } } });
{
         "result" : "mr_out",
         "timeMillis" : 35,
         "counts" : {
                 "input" : 7, // 3
                "emit" : 7,
                "output" : 3
        },
        "ok" : 1,
}
> db.mr_out.find() //

{ "_id" : "A",
  "value" : { "age" : 80, "num" : 2, "avg" : 40 } }
{ "_id" : "B",
  "value" : { "age" : 89, "num" : 2, "avg" : 44.5 } }
{ "_id" : "C",
  "value" : { "age" : 102, "num" : 3, "avg" : 34 } }
db.items.insert({ date: "2011-06-01", item: "apple", price: 100 })
db.items.insert({ date: "2011-06-01", item: "banana", price: 200 })
db.items.insert({ date: "2011-06-01", item: "apple" , price :100})
db.items.insert({ date: "2011-06-02", item: "orange", price: 50 })
db.items.insert({ date: "2011-06-02", item: "orange", price: 50 })
db.items.insert({ date: "2011-06-02", item: "apple", price: 100 })
m = function() { emit(this.item, this.price); }
r = function(key,values) {
      var result = 0;
      values.forEach( function(value){ result += value } );
      return result;
}
> res = db.items.mapReduce( m, r, { query: {date: "2011-06-01"} ,
out: {replace: "mr_out2"}} );
{
        "result" : "mr_out2",
        "timeMillis" : 10,
        "counts" : {
                "input" : 3,
                "emit" : 3,
                "output" : 2
        },
        "ok" : 1,
}
>db.mr_out2.find()
{ "_id" : "apple", "value" : 200 }
{ "_id" : "banana", "value" : 200 }
> res = db.items.mapReduce( m, r,
  { query: {date: "2011-06-02"} , out: {reduce: "mr_out2"}} );
{
        "result" : "mr_out2",
        "timeMillis" : 23,
        "counts" : {
                "input" : 3,
                "emit" : 3,
                "output" : 3
        },
        "ok" : 1,
}
> db.mr_out2.find()
{ "_id" : "apple", "value" : 300 } //
{ "_id" : "banana", "value" : 200 } //
{ "_id" : "orange", "value" : 100 } //
MongoDB全機能解説2
MongoDB全機能解説2

More Related Content

What's hot

MySQL flexible schema and JSON for Internet of Things
MySQL flexible schema and JSON for Internet of ThingsMySQL flexible schema and JSON for Internet of Things
MySQL flexible schema and JSON for Internet of ThingsAlexander Rubin
 
San Francisco Java User Group
San Francisco Java User GroupSan Francisco Java User Group
San Francisco Java User Groupkchodorow
 
MongoDB Europe 2016 - Enabling the Internet of Things at Proximus - Belgium's...
MongoDB Europe 2016 - Enabling the Internet of Things at Proximus - Belgium's...MongoDB Europe 2016 - Enabling the Internet of Things at Proximus - Belgium's...
MongoDB Europe 2016 - Enabling the Internet of Things at Proximus - Belgium's...MongoDB
 
MongoDB Performance Tuning
MongoDB Performance TuningMongoDB Performance Tuning
MongoDB Performance TuningPuneet Behl
 
Super Advanced Python –act1
Super Advanced Python –act1Super Advanced Python –act1
Super Advanced Python –act1Ke Wei Louis
 
From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)Night Sailer
 
Mongo db modifiers
Mongo db modifiersMongo db modifiers
Mongo db modifierszarigatongy
 
Webinar: Replication and Replica Sets
Webinar: Replication and Replica SetsWebinar: Replication and Replica Sets
Webinar: Replication and Replica SetsMongoDB
 
Paris js extensions
Paris js extensionsParis js extensions
Paris js extensionserwanl
 
Embedding a language into string interpolator
Embedding a language into string interpolatorEmbedding a language into string interpolator
Embedding a language into string interpolatorMichael Limansky
 
Tipo virus espia con esto aprenderan a espiar a personas etc jeropas de mrd :v
Tipo virus espia con esto aprenderan a espiar a personas etc jeropas de mrd :v Tipo virus espia con esto aprenderan a espiar a personas etc jeropas de mrd :v
Tipo virus espia con esto aprenderan a espiar a personas etc jeropas de mrd :v Arian Gutierrez
 
Andreas Roth - GraphQL erfolgreich im Backend einsetzen
Andreas Roth - GraphQL erfolgreich im Backend einsetzenAndreas Roth - GraphQL erfolgreich im Backend einsetzen
Andreas Roth - GraphQL erfolgreich im Backend einsetzenDevDay Dresden
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on AndroidSven Haiges
 
MongoDB Aggregation Framework in action !
MongoDB Aggregation Framework in action !MongoDB Aggregation Framework in action !
MongoDB Aggregation Framework in action !Sébastien Prunier
 
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
 

What's hot (20)

MySQL flexible schema and JSON for Internet of Things
MySQL flexible schema and JSON for Internet of ThingsMySQL flexible schema and JSON for Internet of Things
MySQL flexible schema and JSON for Internet of Things
 
San Francisco Java User Group
San Francisco Java User GroupSan Francisco Java User Group
San Francisco Java User Group
 
Litebox
LiteboxLitebox
Litebox
 
MongoDB Europe 2016 - Enabling the Internet of Things at Proximus - Belgium's...
MongoDB Europe 2016 - Enabling the Internet of Things at Proximus - Belgium's...MongoDB Europe 2016 - Enabling the Internet of Things at Proximus - Belgium's...
MongoDB Europe 2016 - Enabling the Internet of Things at Proximus - Belgium's...
 
Mongo db presentation
Mongo db presentationMongo db presentation
Mongo db presentation
 
MongoDB Performance Tuning
MongoDB Performance TuningMongoDB Performance Tuning
MongoDB Performance Tuning
 
Super Advanced Python –act1
Super Advanced Python –act1Super Advanced Python –act1
Super Advanced Python –act1
 
From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)From mysql to MongoDB(MongoDB2011北京交流会)
From mysql to MongoDB(MongoDB2011北京交流会)
 
Mongo db modifiers
Mongo db modifiersMongo db modifiers
Mongo db modifiers
 
Webinar: Replication and Replica Sets
Webinar: Replication and Replica SetsWebinar: Replication and Replica Sets
Webinar: Replication and Replica Sets
 
Elm: give it a try
Elm: give it a tryElm: give it a try
Elm: give it a try
 
Paris js extensions
Paris js extensionsParis js extensions
Paris js extensions
 
Mongo db dla administratora
Mongo db dla administratoraMongo db dla administratora
Mongo db dla administratora
 
Embedding a language into string interpolator
Embedding a language into string interpolatorEmbedding a language into string interpolator
Embedding a language into string interpolator
 
Mongodb workshop
Mongodb workshopMongodb workshop
Mongodb workshop
 
Tipo virus espia con esto aprenderan a espiar a personas etc jeropas de mrd :v
Tipo virus espia con esto aprenderan a espiar a personas etc jeropas de mrd :v Tipo virus espia con esto aprenderan a espiar a personas etc jeropas de mrd :v
Tipo virus espia con esto aprenderan a espiar a personas etc jeropas de mrd :v
 
Andreas Roth - GraphQL erfolgreich im Backend einsetzen
Andreas Roth - GraphQL erfolgreich im Backend einsetzenAndreas Roth - GraphQL erfolgreich im Backend einsetzen
Andreas Roth - GraphQL erfolgreich im Backend einsetzen
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on Android
 
MongoDB Aggregation Framework in action !
MongoDB Aggregation Framework in action !MongoDB Aggregation Framework in action !
MongoDB Aggregation Framework in action !
 
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
 

Viewers also liked

Mongo dbのgridfsについて
Mongo dbのgridfsについてMongo dbのgridfsについて
Mongo dbのgridfsについてMasahiro Saito
 
MongoDBざっくり解説
MongoDBざっくり解説MongoDBざっくり解説
MongoDBざっくり解説知教 本間
 
はじめてのMongoDB
はじめてのMongoDBはじめてのMongoDB
はじめてのMongoDBTakahiro Inoue
 
Mongo DBを半年運用してみた
Mongo DBを半年運用してみたMongo DBを半年運用してみた
Mongo DBを半年運用してみたMasakazu Matsushita
 
MongoDB全機能解説1
MongoDB全機能解説1MongoDB全機能解説1
MongoDB全機能解説1Takahiro Inoue
 
イマドキのフロントエンドエンジニアの道具箱
イマドキのフロントエンドエンジニアの道具箱イマドキのフロントエンドエンジニアの道具箱
イマドキのフロントエンドエンジニアの道具箱Fumio SAGAWA
 
MongoDBと位置情報 ~地理空間インデックスの紹介
MongoDBと位置情報 ~地理空間インデックスの紹介MongoDBと位置情報 ~地理空間インデックスの紹介
MongoDBと位置情報 ~地理空間インデックスの紹介Koji Iwazaki
 

Viewers also liked (7)

Mongo dbのgridfsについて
Mongo dbのgridfsについてMongo dbのgridfsについて
Mongo dbのgridfsについて
 
MongoDBざっくり解説
MongoDBざっくり解説MongoDBざっくり解説
MongoDBざっくり解説
 
はじめてのMongoDB
はじめてのMongoDBはじめてのMongoDB
はじめてのMongoDB
 
Mongo DBを半年運用してみた
Mongo DBを半年運用してみたMongo DBを半年運用してみた
Mongo DBを半年運用してみた
 
MongoDB全機能解説1
MongoDB全機能解説1MongoDB全機能解説1
MongoDB全機能解説1
 
イマドキのフロントエンドエンジニアの道具箱
イマドキのフロントエンドエンジニアの道具箱イマドキのフロントエンドエンジニアの道具箱
イマドキのフロントエンドエンジニアの道具箱
 
MongoDBと位置情報 ~地理空間インデックスの紹介
MongoDBと位置情報 ~地理空間インデックスの紹介MongoDBと位置情報 ~地理空間インデックスの紹介
MongoDBと位置情報 ~地理空間インデックスの紹介
 

Similar to MongoDB全機能解説2

Map/Confused? A practical approach to Map/Reduce with MongoDB
Map/Confused? A practical approach to Map/Reduce with MongoDBMap/Confused? A practical approach to Map/Reduce with MongoDB
Map/Confused? A practical approach to Map/Reduce with MongoDBUwe Printz
 
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Masahiro Nagano
 
MongoDB .local Houston 2019: Using Client Side Encryption in MongoDB 4.2
MongoDB .local Houston 2019: Using Client Side Encryption in MongoDB 4.2MongoDB .local Houston 2019: Using Client Side Encryption in MongoDB 4.2
MongoDB .local Houston 2019: Using Client Side Encryption in MongoDB 4.2MongoDB
 
Schema Design with MongoDB
Schema Design with MongoDBSchema Design with MongoDB
Schema Design with MongoDBrogerbodamer
 
MongoDB Performance Tuning
MongoDB Performance TuningMongoDB Performance Tuning
MongoDB Performance TuningMongoDB
 
Elasticsearch in 15 Minutes
Elasticsearch in 15 MinutesElasticsearch in 15 Minutes
Elasticsearch in 15 MinutesKarel Minarik
 
MongoDB San Francisco 2013: Hash-based Sharding in MongoDB 2.4 presented by B...
MongoDB San Francisco 2013: Hash-based Sharding in MongoDB 2.4 presented by B...MongoDB San Francisco 2013: Hash-based Sharding in MongoDB 2.4 presented by B...
MongoDB San Francisco 2013: Hash-based Sharding in MongoDB 2.4 presented by B...MongoDB
 
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB
 
Webinar: General Technical Overview of MongoDB for Dev Teams
Webinar: General Technical Overview of MongoDB for Dev TeamsWebinar: General Technical Overview of MongoDB for Dev Teams
Webinar: General Technical Overview of MongoDB for Dev TeamsMongoDB
 
Apache CouchDB Presentation @ Sept. 2104 GTALUG Meeting
Apache CouchDB Presentation @ Sept. 2104 GTALUG MeetingApache CouchDB Presentation @ Sept. 2104 GTALUG Meeting
Apache CouchDB Presentation @ Sept. 2104 GTALUG MeetingMyles Braithwaite
 
MongoDB World 2019: Using Client Side Encryption in MongoDB 4.2 Link
MongoDB World 2019: Using Client Side Encryption in MongoDB 4.2 LinkMongoDB World 2019: Using Client Side Encryption in MongoDB 4.2 Link
MongoDB World 2019: Using Client Side Encryption in MongoDB 4.2 LinkMongoDB
 
NoSQL & MongoDB
NoSQL & MongoDBNoSQL & MongoDB
NoSQL & MongoDBShuai Liu
 
Peggy elasticsearch應用
Peggy elasticsearch應用Peggy elasticsearch應用
Peggy elasticsearch應用LearningTech
 
Geospatial Indexing and Querying with MongoDB
Geospatial Indexing and Querying with MongoDBGeospatial Indexing and Querying with MongoDB
Geospatial Indexing and Querying with MongoDBGrant Goodale
 
10 Key MongoDB Performance Indicators
10 Key MongoDB Performance Indicators  10 Key MongoDB Performance Indicators
10 Key MongoDB Performance Indicators iammutex
 

Similar to MongoDB全機能解説2 (20)

Map/Confused? A practical approach to Map/Reduce with MongoDB
Map/Confused? A practical approach to Map/Reduce with MongoDBMap/Confused? A practical approach to Map/Reduce with MongoDB
Map/Confused? A practical approach to Map/Reduce with MongoDB
 
MongoDB With Style
MongoDB With StyleMongoDB With Style
MongoDB With Style
 
Couchdb
CouchdbCouchdb
Couchdb
 
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
 
MongoDB .local Houston 2019: Using Client Side Encryption in MongoDB 4.2
MongoDB .local Houston 2019: Using Client Side Encryption in MongoDB 4.2MongoDB .local Houston 2019: Using Client Side Encryption in MongoDB 4.2
MongoDB .local Houston 2019: Using Client Side Encryption in MongoDB 4.2
 
Books
BooksBooks
Books
 
Schema Design with MongoDB
Schema Design with MongoDBSchema Design with MongoDB
Schema Design with MongoDB
 
MongoDB Performance Tuning
MongoDB Performance TuningMongoDB Performance Tuning
MongoDB Performance Tuning
 
Elasticsearch in 15 Minutes
Elasticsearch in 15 MinutesElasticsearch in 15 Minutes
Elasticsearch in 15 Minutes
 
MongoDB San Francisco 2013: Hash-based Sharding in MongoDB 2.4 presented by B...
MongoDB San Francisco 2013: Hash-based Sharding in MongoDB 2.4 presented by B...MongoDB San Francisco 2013: Hash-based Sharding in MongoDB 2.4 presented by B...
MongoDB San Francisco 2013: Hash-based Sharding in MongoDB 2.4 presented by B...
 
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
 
Latinoware
LatinowareLatinoware
Latinoware
 
Webinar: General Technical Overview of MongoDB for Dev Teams
Webinar: General Technical Overview of MongoDB for Dev TeamsWebinar: General Technical Overview of MongoDB for Dev Teams
Webinar: General Technical Overview of MongoDB for Dev Teams
 
Apache CouchDB Presentation @ Sept. 2104 GTALUG Meeting
Apache CouchDB Presentation @ Sept. 2104 GTALUG MeetingApache CouchDB Presentation @ Sept. 2104 GTALUG Meeting
Apache CouchDB Presentation @ Sept. 2104 GTALUG Meeting
 
MongoDB World 2019: Using Client Side Encryption in MongoDB 4.2 Link
MongoDB World 2019: Using Client Side Encryption in MongoDB 4.2 LinkMongoDB World 2019: Using Client Side Encryption in MongoDB 4.2 Link
MongoDB World 2019: Using Client Side Encryption in MongoDB 4.2 Link
 
NoSQL & MongoDB
NoSQL & MongoDBNoSQL & MongoDB
NoSQL & MongoDB
 
Peggy elasticsearch應用
Peggy elasticsearch應用Peggy elasticsearch應用
Peggy elasticsearch應用
 
Geospatial Indexing and Querying with MongoDB
Geospatial Indexing and Querying with MongoDBGeospatial Indexing and Querying with MongoDB
Geospatial Indexing and Querying with MongoDB
 
Sensmon couchdb
Sensmon couchdbSensmon couchdb
Sensmon couchdb
 
10 Key MongoDB Performance Indicators
10 Key MongoDB Performance Indicators  10 Key MongoDB Performance Indicators
10 Key MongoDB Performance Indicators
 

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
 

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版)
 
Advanced MongoDB #1
Advanced MongoDB #1Advanced MongoDB #1
Advanced MongoDB #1
 

Recently uploaded

Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutesconfluent
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...Sri Ambati
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Product School
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2DianaGray10
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaRTTS
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Alison B. Lowndes
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform EngineeringJemma Hussein Allen
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1DianaGray10
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyJohn Staveley
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesThousandEyes
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsExpeed Software
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...Elena Simperl
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlPeter Udo Diehl
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance
 

Recently uploaded (20)

Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
In-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT ProfessionalsIn-Depth Performance Testing Guide for IT Professionals
In-Depth Performance Testing Guide for IT Professionals
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 

MongoDB全機能解説2

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11. { "_id" : <unspecified>, //file ID "length" : data_number, // bytes "chunkSize" : data_number, // :256KB "uploadDate" : data_date, //file "md5" : data_string //"filemd5" }
  • 12. { "filename" : data_string, "contentType" : data_string, "aliases" : data_array of data_string, "metadata" : data_object, }
  • 13. { "_id" : <unspecified>, //chunk ID "files_id" : <unspecified>, //file _id "n" : chunk_number, //0 chunk 0,1,2... chunk "data" : data_binary, // BSON }
  • 14. > db.fs.chunks.ensureIndex( {files_id:1, n:1}, {unique: true}); > db.fs.chunks.findOne({files_id: myFileID, n: 0});
  • 15. ➜ ~ mongofiles --help usage: mongofiles [options] command [gridfs filename] command: one of (list|search|put|get) list - file search - file put - file get - file delete - file
  • 16. ➜ ~ mongofiles list connected to: 127.0.0.1 ➜ ~ mongofiles put ByeForNow.mp3 connected to: 127.0.0.1 added file: { _id: ObjectId('4df17f8d9d47ba5c0247e72e'), filename: "ByeForNow.mp3", chunkSize: 262144, uploadDate: new Date(1307672462538), md5: "9ee9472200a2e18bf376ce622c3b0055", length: 11183104 } done! ➜ ~ mongofiles list -v // -v Fri Jun 10 11:21:05 creating new connection to:127.0.0.1 Fri Jun 10 11:21:05 BackgroundJob starting: connected to: 127.0.0.1 ByeForNow.mp3 11183104
  • 17. ➜ ~ mongofiles put Maria.mp3 connected to: 127.0.0.1 added file: { _id: ObjectId('4df181fc5e354129e833193f'), filename: "Maria.mp3", chunkSize: 262144, uploadDate: new Date(1307673086293), md5: "9d4f424fa1843711e196e502d8a00183", length: 12225353 } done! ➜ ~ mongofiles list connected to: 127.0.0.1 ByeForNow.mp3 11183104 Maria.mp3 12225353 ➜ ~ mongofiles list M connected to: 127.0.0.1 Maria.mp3 12225353 ➜ ~ mongofiles search .mp3 connected to: 127.0.0.1 ByeForNow.mp3 11183104 Maria.mp3 12225353
  • 18. ~ mkdir tmp // get ➜ ~ cd tmp ➜ mongofiles get Maria.mp3 connected to: 127.0.0.1 done write to: Maria.mp3 ➜ ls Maria.mp3 ➜ mongofiles get Bye ERROR: file not found ➜ mongofiles get ByeForNow.mp3 done write to: ByeForNow.mp3 ➜ md5 Maria.mp3 MD5 (Maria.mp3) = 9d4f424fa1843711e196e502d8a00183 ➜ md5 ../Maria.mp3 MD5 (../Maria.mp3) = 9d4f424fa1843711e196e502d8a00183
  • 19. > db.fs.files.find().forEach(printjson) { "_id" : ObjectId("4df17f8d9d47ba5c0247e72e"), "filename" : "ByeForNow.mp3", "chunkSize" : 262144, "uploadDate" : ISODate("2011-06-10T02:21:02.538Z"), "md5" : "9ee9472200a2e18bf376ce622c3b0055", "length" : 11183104 } { "_id" : ObjectId("4df181fc5e354129e833193f"), "filename" : "Maria.mp3", "chunkSize" : 262144, "uploadDate" : ISODate("2011-06-10T02:31:26.293Z"), "md5" : "9d4f424fa1843711e196e502d8a00183", "length" : 12225353 }
  • 20. > db.fs.chunks.findOne( {n:0,files_id:ObjectId("4df181fc5e354129e833193f")}) { "_id" : ObjectId("4df181fcd40994ca1de28d09"), "files_id" : ObjectId("4df181fc5e354129e833193f"), "n" : 0, "data" : BinData(0,"SUQzAwAAAABQdlRSQ0sAAAACAAAAM1RJVDIA AAAHAAAAg32DioNBVUZJRAAAAGYAAGh0dHA6Ly93d3cuY2RkYi5jb20vaWQ zL3RhZ2luZm8xLmh0bWwAM0NEM00xMTBRMjA3NTYwOTc4VjY4MTBCQTlBNj UzN0JCQUQ1QTgyOUE4NTRCRkQ2QTdBRjNQOAAAAAAAAAAAAEdFT0IAACNgA AAAYXBwbGljYX...) }
  • 21. > db.fs.chunks.ensureIndex({files_id: 1}); > db.runCommand({ shardcollection : "test.fs.chunks", key : { files_id : 1 }}) { "collectionsharded" : "test.fs.chunks", "ok" : 1 }
  • 22. MongoDB GridFS
  • 23. Replace Amazon S3 with MongoDB GridFS and Grails
  • 24.
  • 25.
  • 26. { loc : [ 50 , 30 ] } { loc : { x : 50 , y : 30 } } { loc : { foo : 50 , y : 30 } } { loc : { long : 40.739037, lat: 73.992964 } }
  • 27. db.places.ensureIndex( { loc : "2d" } ) db.places.ensureIndex( { loc : "2d" } , { min : -500 , max : 500 } )
  • 28. db.places.find( { loc : [50,50] } ) db.places.find( { loc : { $near : [50,50] } } ) db.places.find( { loc : { $near : [50,50] } } ).limit(20) db.places.find( { loc : { $near : [50,50] , $maxDistance : 5 } } ).limit(20)
  • 29. // > box = [[40.73083, -73.99756], [40.741404, -73.988135]] > db.places.find({"loc" : {"$within" : {"$box" : box}}}) // > center = [50, 50] > radius = 10 > db.places.find({"loc" : {"$within" : {"$center" : [center, radius]}}}) // v1.9 > polygonA = [ [ 10, 20 ], [ 10, 40 ], [ 30, 40 ], [ 30, 20 ] ] > polygonB = { a : { x : 10, y : 20 }, b : { x : 15, y : 25 }, c : { x : 20, y : 20 } } > db.places.find({ "loc" : { "$within" : { "$polygon" : polygonA } } }) > db.places.find({ "loc" : { "$within" : { "$polygon" : polygonB } } })
  • 30. > db.runCommand( { geoNear : "places" , near : [ 50 , 50 ], num : 10, query : { type : "museum" } } ); { "ns" : "test.places", "near" : "1100110000001111110000001111110000001111110000001111", "results" : [ { "dis" : 69.29646421910687, "obj" : { "_id" : ObjectId("4b8bd6b93b83c574d8760280"), "y" : [ 1, 1 ], "category" : "Coffee" } }, { "dis" : 69.29646421910687, "obj" : { "_id" : ObjectId("4b8bd6b03b83c574d876027f"), 1 ...}
  • 32.
  • 33. > db.points.insert({ pos : { long : 30, lat : 30 } }) > db.points.insert({ pos : { long : -10, lat : -20 } }) > db.points.ensureIndex({ pos : "2d" }) > db.points.find({ pos: { $nearSphere: [0,0], $maxDistance : 0.4 } }) { "_id" : ObjectId("4df11e47b8e84370f84afdd3"), "pos" : { "long" : -10, "lat" : -20 } }
  • 34. > var earthRadius = 6378 // km > var range = 3000 // km > distances = db.runCommand({ geoNear : "points", near : [0, 0], spherical : true, maxDistance : range / earthRadius }).results [ { "dis" : 0.3886630122897946, // "obj" : { "_id" : ObjectId("4df11e47b8e84370f84afdd3"), "pos" : { "long" : -10, "lat" : -20 } } } ] > pointDistance = distances[0].dis * earthRadius 2478.89269238431 // km
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 44.
  • 45.
  • 46. ~ mkdir -p shard/shard00 ~ mkdir -p shard/shard01 ~ mkdir -p shard/shard02 ~ mkdir -p shard/config ~ mongod --shardsvr --port 27017 --dbpath shard/shard00 ~ mongod --shardsvr --port 27018 --dbpath shard/shard01 ~ mongod --shardsvr --port 27019 --dbpath shard/shard02 ~ mongod --configsvr --port 27020 --dbpath shard/config ~ mongos --configdb localhost:27020 --port 27021
  • 47. ~ mongo localhost:27021 // mongos MongoDB shell version: 1.8.0 connecting to: localhost:27021/test > show dbs config 0.1875GB // sharding > db.adminCommand( { addshard: "localhost:27017", name: "shard00" } ) { "shardAdded" : "shard00", "ok" : 1 } > db.adminCommand( { addshard: "localhost:27018", name: "shard01" } ) { "shardAdded" : "shard01", "ok" : 1 } > db.adminCommand( { addshard: "localhost:27019", name: "shard02" } ) { "shardAdded" : "shard02", "ok" : 1 }
  • 48. // mongos > db.adminCommand( { enablesharding : "test" } ) { "ok" : 1 } > db.adminCommand( { moveprimary : "test", to : "shard02" } ); { "primary " : "shard02:localhost:27019", "ok" : 1 } > db.adminCommand( { shardcollection : "test.myshard", key : { n : 1 } } ) { "collectionsharded" : "test.myshard", "ok" : 1 }
  • 49. // mongos > db.adminCommand({split : "test.myshard", middle : { n: 0 } } ) { "ok" : 1 } > db.adminCommand({split : "test.myshard", middle : { n: 1 } } ) { "ok" : 1 } > db.adminCommand({split : "test.myshard", middle : { n: 2 } } ) { "ok" : 1 }
  • 50. > db.printShardingStatus() // --- Sharding Status --- sharding version: { "_id" : 1, "version" : 3 } shards: { "_id" : "shard00", "host" : "localhost:27017" } { "_id" : "shard01", "host" : "localhost:27018" } { "_id" : "shard02", "host" : "localhost:27019" } databases: { "_id" : "admin", "partitioned" : false, "primary" : "config" } { "_id" : "test", "partitioned" : true, "primary" : "shard02" } test.myshard chunks: shard02 4 { "n" : { $minKey : 1 } } -->> { "n" : 0 } on : shard02 { "t" : 1000, "i" : 1 } { "n" : 0 } -->> { "n" : 1 } on : shard02 { "t" : 1000, "i" : 3 } { "n" : 1 } -->> { "n" : 2 } on : shard02 { "t" : 1000, "i" : 5 } { "n" : 2 } -->> { "n" : { $maxKey : 1 } } on : shard02 { "t" : 1000, "i" : 6 }
  • 51. // mongos > db.adminCommand({moveChunk: "test.myshard", find: { n: 0 }, to: "shard00" }); { "millis" : 1051, "ok" : 1 } > db.adminCommand({moveChunk: "test.myshard", find: { n: 1 }, to: "shard01" }); { "millis" : 1046, "ok" : 1 } > db.adminCommand({moveChunk :"test.myshard", find: { n: 2 }, to: "shard02" }); { "ok" : 0, "errmsg" : "that chunk is already on that shard" }
  • 52. > db.printShardingStatus() --- Sharding Status --- sharding version: { "_id" : 1, "version" : 3 } shards: { "_id" : "shard00", "host" : "localhost:27017" } { "_id" : "shard01", "host" : "localhost:27018" } { "_id" : "shard02", "host" : "localhost:27019" } databases: { "_id" : "admin", "partitioned" : false, "primary" : "config" } { "_id" : "test", "partitioned" : true, "primary" : "shard02" } test.myshard chunks: shard02 2 shard00 1 shard01 1 { "n" : { $minKey : 1 } } -->> { "n" : 0 } on : shard02 { "t" : 3000, "i" : 1 } { "n" : 0 } -->> { "n" : 1 } on : shard00 { "t" : 2000, "i" : 0 } { "n" : 1 } -->> { "n" : 2 } on : shard01 { "t" : 3000, "i" : 0 } { "n" : 2 } -->> { "n" : { $maxKey : 1 } } on : shard02 { "t" : 1000, "i" : 6 }
  • 53. // mongos > for(var m=0; m<100; m++){ db.myshard.insert({n: m % 3}) } // n =0,1,2,0,1,... > printShardingSizes() // Shard ... test.myshard chunks: { "n" : { $minKey : 1 } } -->> { "n" : 0 } on : shard02 { "estimate" : false, "size" : 0, "numObjects" : 0 } { "n" : 0 } -->> { "n" : 1 } on : shard00 { "estimate" : false, "size" : 1224, "numObjects" : 34 } { "n" : 1 } -->> { "n" : 2 } on : shard01 { "estimate" : false, "size" : 1188, "numObjects" : 33 } { "n" : 2 } -->> { "n" : { $maxKey : 1 } } on : shard02 { "estimate" : false, "size" : 1188, "numObjects" : 33 }
  • 54. ~ mongo localhost:27017 > db.myshard.count() 34 > db.myshard.distinct("n") [ 0 ] ➜ ~ mongo localhost:27018 > db.myshard.count() 33 > db.myshard.distinct("n") [ 1 ] ➜ ~ mongo localhost:27019 > db.myshard.count() 33 > db.myshard.distinct("n") [ 2 ]
  • 55.
  • 56.
  • 57. > db.adminCommand( { addshard: "set00/delta1:27017,delta2:27017", name: "shard00" } ) { "shardAdded" : "shard00", "ok" : 1 } > db.adminCommand( { addshard: "set01/delta3:27018,delta4:27018", name: "shard01" } ) { "shardAdded" : "shard01", "ok" : 1 } > db.adminCommand( { addshard: "set02/delta5:27019,delta6:27019", name: "shard02" } ) { "shardAdded" : "shard02", "ok" : 1 }
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 65.
  • 66.
  • 67. db.mycoll.mapReduce( map : <map >, reduce : <reduce > [, finalize : <finalize >] [, query : < >] [, sort : < reduce >] [, out : < >] [, scope : <object where fields go into javascript global scope >] );
  • 68. db.people.insert({userId:1, age:24, type:"A"}) db.people.insert({userId:2, age:47, type:"B"}) db.people.insert({userId:3, age:34, type:"C"}) db.people.insert({userId:4, age:4, type:"B"}) db.people.insert({userId:5, age:14, type:"A"}) db.people.insert({userId:6, age:29, type:"C"}) db.people.insert({userId:7, age:39, type:"C"}) db.people.insert({userId:8, age:42, type:"B"}) db.people.insert({userId:9, age:56, type:"A"}) db.people.insert({userId:10, age:12, type:"A"})
  • 69. m = function() { emit(this.type, { age: this.age, num: 1 } ); }
  • 70. r = function(key, values) { var result = { age: 0, num: 0 }; values.forEach( function(value){ result.age += value.age; // age result.num += value.num; // } ); return result; }
  • 71. r = function(key, values) { var num = 0; var sum = 0; values.forEach( function(value){ sum += value.age; // age num += value.num; // } ); return sum/num; }
  • 72. m = function() { emit(this.type, { age: this.age, num: 1 } ); } r = function(key, values) { var result = { age: 0, num: 0 }; values.forEach( function(value){ result.age += value.age; // age result.num += value.num; // } ); return result; }
  • 73. m = function() { emit(this.type, { age: this.age, num: 1 } ); } r = function(key, values) { var result = { age: 0, num: 0 }; values.forEach( function(value){ result.age += value.age; // result.num += value.num; // } ); return result; }
  • 74. f = function( key, result ){ result.avg = result.age / result.num; return result; }
  • 75. > res = db.people.mapReduce( m , r , { finalize : f , out : "mr_out", verbose: true }); { "result" : "mr_out", // "timeMillis" : 18, // "timing" : { "mapTime" : NumberLong(1), "emitLoop" : 12, "total" : 18 }, "counts" : { "input" : 10, // 10 "emit" : 10, // 10 emit "output" : 3 // 3 }, "ok" : 1, }
  • 76. > db.mr_out.find() { "_id" : "A", "value" : { "age" : 106, "num" : 4, "avg" : 26.5 } } { "_id" : "B", "value" : { "age" : 93, "num" : 3, "avg" : 31 } } { "_id" : "C", "value" : { "age" : 102, "num" : 3, "avg" : 34 } }
  • 77. > res = db.people.mapReduce( m , r , { finalize : f , out : "mr_out", query: { age: { $gte: 20 } } }); { "result" : "mr_out", "timeMillis" : 35, "counts" : { "input" : 7, // 3 "emit" : 7, "output" : 3 }, "ok" : 1, }
  • 78. > db.mr_out.find() // { "_id" : "A", "value" : { "age" : 80, "num" : 2, "avg" : 40 } } { "_id" : "B", "value" : { "age" : 89, "num" : 2, "avg" : 44.5 } } { "_id" : "C", "value" : { "age" : 102, "num" : 3, "avg" : 34 } }
  • 79.
  • 80.
  • 81. db.items.insert({ date: "2011-06-01", item: "apple", price: 100 }) db.items.insert({ date: "2011-06-01", item: "banana", price: 200 }) db.items.insert({ date: "2011-06-01", item: "apple" , price :100}) db.items.insert({ date: "2011-06-02", item: "orange", price: 50 }) db.items.insert({ date: "2011-06-02", item: "orange", price: 50 }) db.items.insert({ date: "2011-06-02", item: "apple", price: 100 })
  • 82. m = function() { emit(this.item, this.price); } r = function(key,values) { var result = 0; values.forEach( function(value){ result += value } ); return result; } > res = db.items.mapReduce( m, r, { query: {date: "2011-06-01"} , out: {replace: "mr_out2"}} ); { "result" : "mr_out2", "timeMillis" : 10, "counts" : { "input" : 3, "emit" : 3, "output" : 2 }, "ok" : 1, } >db.mr_out2.find() { "_id" : "apple", "value" : 200 } { "_id" : "banana", "value" : 200 }
  • 83. > res = db.items.mapReduce( m, r, { query: {date: "2011-06-02"} , out: {reduce: "mr_out2"}} ); { "result" : "mr_out2", "timeMillis" : 23, "counts" : { "input" : 3, "emit" : 3, "output" : 3 }, "ok" : 1, } > db.mr_out2.find() { "_id" : "apple", "value" : 300 } // { "_id" : "banana", "value" : 200 } // { "_id" : "orange", "value" : 100 } //