锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产亚洲精品va在线,亚洲 另类 无码 在线,亚洲人成人77777网站http://m.tkk7.com/envoydada/category/45571.htmlzh-cnTue, 13 Jul 2010 03:23:48 GMTTue, 13 Jul 2010 03:23:48 GMT60Mongodb Import Export Toolshttp://m.tkk7.com/envoydada/archive/2010/07/05/325305.htmlDerek.GuoDerek.GuoMon, 05 Jul 2010 09:52:00 GMThttp://m.tkk7.com/envoydada/archive/2010/07/05/325305.htmlhttp://m.tkk7.com/envoydada/comments/325305.htmlhttp://m.tkk7.com/envoydada/archive/2010/07/05/325305.html#Feedback0http://m.tkk7.com/envoydada/comments/commentRss/325305.htmlhttp://m.tkk7.com/envoydada/services/trackbacks/325305.html

Import Export Tools

These tool just work with the raw data (the documents in the collection); they do not save, or load, the metadata like the defined indexes or (capped) collection properties. You will need to (re)create those yourself in a separate step, before loading that data. Vote here to change this.

mongoimport

This utility takes a single file that contains 1 JSON/CSV/TSV string per line and inserts it. You have to specify a database and a collection.

options:
            --help                  produce help message
            -v [ --verbose ]        be more verbose (include multiple times for more
            			    verbosity e.g. -vvvvv)
            -h [ --host ] arg       mongo host to connect to ("left,right" for pairs)
            -d [ --db ] arg         database to use
            -c [ --collection ] arg collection to use (some commands)
            -u [ --username ] arg   username
            -p [ --password ] arg   password
            --dbpath arg            directly access mongod data files in the given path,
            			    instead of connecting to a mongod instance - needs to
            			    lock the data directory, so cannot be used if a
            			    mongod is currently accessing the same path
            --directoryperdb        if dbpath specified, each db is in a separate
            directory
            -f [ --fields ] arg     comma seperated list of field names e.g. -f name,age
            --fieldFile arg         file with fields names - 1 per line
            --ignoreBlanks          if given, empty fields in csv and tsv will be ignored
            --type arg              type of file to import.  default: json (json,csv,tsv)
            --file arg              file to import from; if not specified stdin is used
            --drop                  drop collection first
            --headerline            CSV,TSV only - use first line as headers
            

mongoexport

This utility takes a collection and exports to either JSON or CSV. You can specify a filter for the query, or a list of fields to output.

Neither JSON nor TSV/CSV can represent all data types. Please be careful not to lose or change data (types) when using this. For full fidelity please use mongodump.

If you want to output CSV, you have to specify the fields in the order you want them.

Example

options:
            --help                  produce help message
            -v [ --verbose ]        be more verbose (include multiple times for more
            			    verbosity e.g. -vvvvv)
            -h [ --host ] arg       mongo host to connect to ("left,right" for pairs)
            -d [ --db ] arg         database to use
            -c [ --collection ] arg collection to use (some commands)
            -u [ --username ] arg   username
            -p [ --password ] arg   password
            --dbpath arg            directly access mongod data files in the given path,
            			    instead of connecting to a mongod instance - needs to
            			    lock the data directory, so cannot be used if a
            			    mongod is currently accessing the same path
            --directoryperdb        if dbpath specified, each db is in a separate
            directory
            -q [ --query ] arg      query filter, as a JSON string
            -f [ --fields ] arg     comma seperated list of field names e.g. -f name,age
            --csv                   export to csv instead of json
            -o [ --out ] arg        output file; if not specified, stdout is used
            

mongodump

This takes a database and outputs it in a binary representation. This is mostly used for doing hot backups of a database.

If you're using sharding and try to migrate data this way, this will dump shard configuration information and overwrite configurations upon restore.
options:
            --help                   produce help message
            -v [ --verbose ]         be more verbose (include multiple times for more
            			     verbosity e.g. -vvvvv)
            -h [ --host ] arg        mongo host to connect to ("left,right" for pairs)
            -d [ --db ] arg          database to use
            -c [ --collection ] arg  collection to use (some commands)
            -u [ --username ] arg    username
            -p [ --password ] arg    password
            --dbpath arg             directly access mongod data files in the given path,
            			     instead of connecting to a mongod instance - needs
            			     to lock the data directory, so cannot be used if a
            				     mongod is currently accessing the same path
            --directoryperdb         if dbpath specified, each db is in a separate
            directory
            -o [ --out ] arg (=dump) output directory
            

Example: Dumping Everything

To dump all of the collections in all of the databases, run mongodump with just the --host:

$ ./mongodump --host prod.example.com
            connected to: prod.example.com
            all dbs
            DATABASE: log    to   dump/log
            log.errors to dump/log/errors.bson
            713 objects
            log.analytics to dump/log/analytics.bson
            234810 objects
            DATABASE: blog    to    dump/blog
            blog.posts to dump/log/blog.posts.bson
            59 objects
            DATABASE: admin    to    dump/admin
            

You'll then have a folder called "dump" in your current directory.

If you're running mongod locally on the default port, you can just do:

$ ./mongodump
            

Example: Dumping a Single Collection

If we just want to dump a single collection, we can specify it and get a single .bson file.

$ ./mongodump --db blog --collection posts
            connected to: 127.0.0.1
            DATABASE: blog        to     dump/blog
            blog.posts to dump/blog/posts.bson
            59 objects
            

mongorestore

This takes the output from mongodump and restores it.

usage: ./mongorestore [options] [directory or filename to restore from]
            options:
            --help                  produce help message
            -v [ --verbose ]        be more verbose (include multiple times for more
            			    verbosity e.g. -vvvvv)
            -h [ --host ] arg       mongo host to connect to ("left,right" for pairs)
            -d [ --db ] arg         database to use
            -c [ --collection ] arg collection to use (some commands)
            -u [ --username ] arg   username
            -p [ --password ] arg   password
            --dbpath arg            directly access mongod data files in the given path,
            				    instead of connecting to a mongod instance - needs to
            				    lock the data directory, so cannot be used if a
            			    mongod is currently accessing the same path
            --directoryperdb        if dbpath specified, each db is in a separate
            directory
            --drop                  drop each collection before import
            --objcheck              validate object before inserting


Derek.Guo 2010-07-05 17:52 鍙戣〃璇勮
]]>
Mongodb dbshell Referencehttp://m.tkk7.com/envoydada/archive/2010/07/05/325266.htmlDerek.GuoDerek.GuoMon, 05 Jul 2010 03:15:00 GMThttp://m.tkk7.com/envoydada/archive/2010/07/05/325266.htmlhttp://m.tkk7.com/envoydada/comments/325266.htmlhttp://m.tkk7.com/envoydada/archive/2010/07/05/325266.html#Feedback0http://m.tkk7.com/envoydada/comments/commentRss/325266.htmlhttp://m.tkk7.com/envoydada/services/trackbacks/325266.html闃呰鍏ㄦ枃

Derek.Guo 2010-07-05 11:15 鍙戣〃璇勮
]]>
杞琺ongodb鍏ラ棬http://m.tkk7.com/envoydada/archive/2010/06/23/324266.htmlDerek.GuoDerek.GuoWed, 23 Jun 2010 07:40:00 GMThttp://m.tkk7.com/envoydada/archive/2010/06/23/324266.htmlhttp://m.tkk7.com/envoydada/comments/324266.htmlhttp://m.tkk7.com/envoydada/archive/2010/06/23/324266.html#Feedback0http://m.tkk7.com/envoydada/comments/commentRss/324266.htmlhttp://m.tkk7.com/envoydada/services/trackbacks/324266.html闃呰鍏ㄦ枃

Derek.Guo 2010-06-23 15:40 鍙戣〃璇勮
]]>
Mongodb Dynamic querys selecthttp://m.tkk7.com/envoydada/archive/2010/06/23/324255.htmlDerek.GuoDerek.GuoWed, 23 Jun 2010 06:13:00 GMThttp://m.tkk7.com/envoydada/archive/2010/06/23/324255.htmlhttp://m.tkk7.com/envoydada/comments/324255.htmlhttp://m.tkk7.com/envoydada/archive/2010/06/23/324255.html#Feedback0http://m.tkk7.com/envoydada/comments/commentRss/324255.htmlhttp://m.tkk7.com/envoydada/services/trackbacks/324255.htmlMySQL:
    
SELECT * FROM user
Mongo:    
    db.
user.find()


MySQL:
    
SELECT * FROM user WHERE name = 'foobar'
Mongo:    
    db.
user.find({'name' : 'foobar'})


MySQL:
    
INSERT INOT user (`name`, `age`) values ('foobar',25)
Mongo:    
   db.
user.insert({'name' : 'foobar''age' : 25})


if you want add a  column `email` on MySQL,you must :
   
ALTER TABLE user….
But 
in Mongo,you can just:    
  db.
user.insert({'name' : 'foobar''age' : 25'email' : 'foo@bar.com'})


MySQL:
    
DELETE * FROM user
Mongo:    
    db.
user.remove({})


MySQL:
    
DELETE FROM user WHERE age < 30
Mongo:    
    db.
user.remove({'age' : {$lt : 30}})

$gt : 
> ; $gte : >= ; $lt : < ; $lte : <= ; $ne : !=


MySQL:
    
UPDATE user SET `age` = 36 WHERE `name` = 'foobar'
Mongo:    
    db.
user.update({'name' : 'foobar'}, {$set : {'age' : 36}})


MySQL:
    
UPDATE user SET `age` = `age` + 3 WHERE `name` = 'foobar'
Mongo:    
   db.
user.update({'name' : 'foobar'}, {$inc : {'age' : 3}})

        See more @ http:
//www.mongodb.org/display/DOCS/Updating


MySQL:
    
SELECT COUNT(*FROM user WHERE `name` = 'foobar'
Mongo:    
    db.
user.find({'name' : 'foobar'}).count() 鎴?db.user.count({name:'foobar'});


MySQL:
    
SELECT * FROM user limit 10,20
Mongo:    
   db.
user.find().skip(10).limit(20)


MySQL:
    
SELECT * FROM user WHERE `age` IN (2535,45)
Mongo:    
    db.
user.find({'age' : {$in : [25, 35, 45]}})


MySQL:
    
SELECT * FROM user ORDER BY age DESC
Mongo:    
    db.
user.find().sort({'age' : -1})


MySQL:
    
SELECT DISTINCT(name) FROM user WHERE age > 20
Mongo:    
   db.
user.distinct('name', {'age': {$lt : 20}})


MySQL:
    
SELECT name, sum(marks) FROM user GROUP BY name
Mongo:    
    db.
user.group({
        
key : {'name' : true},
        cond: {
'name' : 'foo'},
        reduce: 
function(obj,prev) { prev.msum += obj.marks; },
        initial: {msum : 
0}
    });


MySQL:
    
SELECT name FROM user WHERE age < 20
Mongo:    
   db.
user.find('this.age < 20', {name : 1})

Derek.Guo 2010-06-23 14:13 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 青青草国产免费久久久下载| 国产AⅤ无码专区亚洲AV| 久久久免费观成人影院| 久久久久亚洲精品天堂| 免费va在线观看| 91av免费观看| av片在线观看永久免费| 国产精品亚洲自在线播放页码 | 免费下载成人电影| 久久亚洲中文无码咪咪爱| 亚洲国产精品久久久久久| 国产精品国产午夜免费福利看 | 亚洲精品乱码久久久久久V | 亚洲卡一卡2卡三卡4麻豆| 国内精品久久久久久久亚洲| 久久电影网午夜鲁丝片免费| 日韩一级片免费观看| 亚洲国产片在线观看| 亚洲色偷偷偷鲁综合| 99国产精品永久免费视频| jyzzjyzz国产免费观看| 亚洲欧美黑人猛交群| 亚洲日本韩国在线| 成人黄动漫画免费网站视频| 免费播放一区二区三区| 黄色视屏在线免费播放| 老牛精品亚洲成av人片| 亚洲免费网站在线观看| 久久亚洲春色中文字幕久久久| 在线亚洲精品自拍| 女人18毛片水真多免费播放| 国产成人免费在线| 久久久久久久岛国免费播放| 中文字幕不卡免费视频| 成人免费av一区二区三区| baoyu777永久免费视频| 精品视频一区二区三区免费| 色欲国产麻豆一精品一AV一免费| 99久久久国产精品免费蜜臀 | 亚洲国产成+人+综合| 亚洲永久在线观看|