카테고리mongoDB

mongoDB join

$lookup (aggregation) On this page Definition Syntax Consideration Examples Definition $lookup New in version 3.2. Performs a left outer join to an unsharded collection in the same database to filter in documents from the “joined” collection for processing. To each input document, the $lookup stage adds a new array field whose elements are the ...

더보기

MongoDB 스키마 디자인을 위한 6가지 규칙 요약

MongoDB 스키마 디자인을 위한 6가지 규칙 요약 MongoDB에서의 관계 구성, 비정규화 전략을 6가지 규칙으로 정리. MongoDB를 개인 프로젝트에서 자주 사용하긴 하는데 항상 쓰던 방식대로만 사용하고 있어서 스키마를 제대로 구성하고 있는지 검색하다가 이 글을 찾게 되었다. MongoDB 블로그에 올라온 포스트인 6 Rules of Thumb for MongoDB Schema Design을 읽고 나서 SQL과 어떻게 ...

더보기

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!