카테고리mongoDB

mongodb export csv

./mongoexport -h 1.226.84.45:5050 -d mongolisa -c author -q ‘{ nationality:”한국”}’ –type=csv -f authorID,name,nationality,isbn,birth_place,birth,category,URL –out author1.csv ./mongoexport -h 1.226.84.45:5050 -d mongolisa -c author -q ‘{ nationality:{$ne:”한국”}}’ –type=csv -f authorID,name,nationality,isbn,birth_place,birth,category,URL –out author1.csv

더보기

mongodb having count

db.getCollection(‘contents’).aggregate([{ ‘$group’: { ‘_id’: {‘isbn’: ‘$isbn’}, ‘count’: {‘$sum’: 1} } }, { ‘$match’: { ‘count’: {‘$gt’: 1} }}])   db.getCollection(‘author’).aggregate([{ ‘$group’: { ‘_id’: {‘isbn’: ‘$isbn’}, ‘count’: {‘$sum’: 1} } }, { ‘$match’: { ‘count’: {‘$gt’: 1} }}])

더보기

mongo export/import

export mongoexport --host 61.97.135.29 --port 27017 --collection contents --db mongolisa --out f:\mongodb\contents.json import mongoimport --host 61.97.135.29 --port 27017 --collection contents --db library --file f:\mongodb\contents.json

더보기

MongoDB Query

db.accounting.aggregate([ {$match:{'institute':'상도','date':{$lt:'2016-02-09'}}}, {$group: {'_id':{'institute':'$institute'},'income':{$sum:'$income'},'outcome':{$sum:'$outcome'}} } ]) db.accounting.aggregate([ { "$match" : { "institute" : "상도"}}, { "$project" : { }}, { "$group" : { "_id" : { "institute" : "$institute"} , "income" : { "$sum" : "$income"} , "outcome" : { "$sum" : "$outcome"} } }, { "$sort" : { }}, ...

더보기

MongoDB Query

insert record db.pub.insert( { "code": 1, "title": "title1", "author": "author1", "publisher": "publisher1", "pub_code": 1001 } ) { "_id" : ObjectId("56bf243a2b2b00a1633a9019"), "code" : 1.0000000000000000, "title" : "title1", "author" : "author1", "publisher" : "publisher1", "pub_code" : 1001.0000000000000000 } insert array db.pub.update( { "pub_code":1001 }, { $push : { "distributor": { "name":"distributor1", "pub_code":2001,"sell_rate":60 ...

더보기

This is a unique website which will require a more modern browser to work!

Please upgrade today!