상세 컨텐츠

본문 제목

MongoDB 설치방법(win) 및 cmd활성화

공부

by 근성 2021. 7. 8. 11:13

본문

mongoDB 이미지입니다.

윈도우로 몽고 DB설치하는 방법입니다.

https://www.mongodb.com/try/download/community

 

MongoDB Community Download

Download the Community version of MongoDB's non-relational database server from MongoDB's download center.

www.mongodb.com

잠깐 !! mongoDB를 설치하기전에
mongoDB는 NOSQL(Not Only SQL의 약자로 기존의 RDMBS형태의 관계 데이터베이스가 아닌 다른 형태의 데이터 저장 기술을 의미합니다.
NOSQL의 장점은 데이터모델 자체가 독립적으로 설계되어있어 데이터를 분산시키는것이 용이하고, 배열 형식의 데이터를 고속으로 처리하는 것이 가능합니다.

 

위 링크를 타고 들어가서

 

대부분의 학생분들이나 아니면 무료로 이용하고 싶어하시는 분들은

community server에 들어가셔서

해당 컴퓨터 사양을 맞게 설정하신 후 download를 받으시면 됩니다.

 

download 후 체크박스를 용도에 맞게 체크하신 후, 다운로드 하시면 됩니다.

 

윈도우 버젼은 community server을 download하신 경우에는 대부분의 경우에는 compass가 깔려져 있습니다.

 

설치가 다 되었다면 작업에 조금 더 편의성을 위해서

명령 프롬프트(cmd)를 통해서도 작업을 할 수 있게 설정을 하겠습니다.

 

제어판 -> 시스템 및 보안 -> 시스템 -> 설정변경 -> 고급 -> 환경변수 -> 편집 -> 디렉터리 찾아보기

로컬디스크 c 안에 program files 안에 MongoDB 안에 서버안에 4.4(버젼) 안에 bin을 디렉터리도 두시면 됩니다.

 

디렉터리 바꾸기 전
디렉터리 바꾼 후

바꾼 후에 윈도우키와 R키를 누르시고 cmd를 열고 mongo를 입력하면 

> Mongo
MongoDB shell version v4.4.6
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("8acf2a8b-236b-427a-b42a-13625624c6f9") }
MongoDB server version: 4.4.6
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
        https://docs.mongodb.com/
Questions? Try the MongoDB Developer Community Forums
        https://community.mongodb.com
---
The server generated these startup warnings when booting:
        2021-07-05T13:02:34.591+09:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
---
---
        Enable MongoDB's free cloud-based monitoring service, which will then receive and display
        metrics about your deployment (disk utilization, CPU, operation statistics, etc).

        The monitoring data will be available on a MongoDB website with a unique URL accessible to you
        and anyone you share the URL with. MongoDB may use this information to make product
        improvements and to suggest MongoDB products and deployment options to you.

        To enable free monitoring, run the following command: db.enableFreeMonitoring()
        To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
---
>

이렇게 출력이 됩니다.

 

use 할 이름

test라는 db를 사용하겠습니다.

db.test.save({'TYPE':'NAME'});

test라는 db에 저의 이름과 저의 베프인 상범이의 이름을 저장시켰습니다.

 

그리고 나서 db를 출력시키면

db.test.find()

이렇게 출력 되는걸 확인 할 수 있습니다.

쿼리플래너와 서버정보 또한 찾을 수 있습니다.

db.test.find().explain()

쿼리플래너가 있어야 쿼리 결과를 도출하고 테이블(데이터 저장 모델)설계를 할 수 있어서 한번씩 확인하는것도 나쁘지 않은 습관인것 같습니다.

> use test
switched to db test
> db.test.save({'name':'junhyeong'});
WriteResult({ "nInserted" : 1 })
> db.test.save({'name':'sangbeom'});
WriteResult({ "nInserted" : 1 })
> db.test.find()
{ "_id" : ObjectId("60e299674af8cab382f18a85"), "name" : "junhyeong" }
{ "_id" : ObjectId("60e2997f4af8cab382f18a86"), "name" : "sangbeom" }//id가 서로 다른 것 또한 확인
> db.test.find().explain()
{
        "queryPlanner" : {
                "plannerVersion" : 1,
                "namespace" : "test.test",
                "indexFilterSet" : false,
                "parsedQuery" : {

                },
                "queryHash" : "8B3D4AB8",
                "planCacheKey" : "8B3D4AB8",
                "winningPlan" : {
                        "stage" : "COLLSCAN",
                        "direction" : "forward"
                },
                "rejectedPlans" : [ ]
        },
        "serverInfo" : {
                "host" : "KW306-39",
                "port" : 27017,
                "version" : "4.4.6",
                "gitVersion" : "72e66213c2c3eab37d9358d5e78ad7f5c1d0d0d7"
        },
        "ok" : 1
}
>

네 이렇게 cmd에서의 mongoDB활성화가 끝이났고, 이어서 mac으로 mongoDB를 설명하겠습니다.

 

'공부' 카테고리의 다른 글

xcrun: error: invalid active developer path  (0) 2023.02.09
chrome driver version error  (0) 2022.06.13
잘못된 공부방법...  (0) 2021.09.01
소수? 어떻게 생각하지  (0) 2021.08.09
공부 카테고리  (0) 2021.07.05

관련글 더보기

댓글 영역