본문 바로가기

엉터리 개발 이야기/nodejs

mongodb 설치 및 기본사용(shell)

반응형

https://www.mongodb.com/download-center#community

1. mongodb comminity 버전 설치

- Windows Server 2008 R2 64-bit and later, with SSL support x64 설치


2. database 실행

설치 폴더 이동 /bin 안에 mongod 실행

- mongod --dbpath c:\mongodb\data


3. database 접속

설치 폴더 이동 /bin 안에 mongo 실행

mongo 실행하면 default로 c:\data\db 에 실행됨, 초기 database는 test

> mongo

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
MongoDB shell version v3.4.10
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.10
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
        http://docs.mongodb.org/
Questions? Try the support group
        http://groups.google.com/group/mongodb-user
Server has startup warnings:
2017-12-03T10:45:21.600+0900 I CONTROL  [initandlisten]
2017-12-03T10:45:21.601+0900 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
 
2017-12-03T10:45:21.601+0900 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2017-12-03T10:45:21.601+0900 I CONTROL  [initandlisten]
2017-12-03T10:45:21.601+0900 I CONTROL  [initandlisten] Hotfix KB2731284 or later update is not installed, will zero-out data files.
2017-12-03T10:45:21.602+0900 I CONTROL  [initandlisten]
cs


1
2
3
4
5
6
7
8
9
10
11
12
13
14
> db
test
> use test1
switched to db test1
> db
test1
> db.users.insertOne({name: "kim" , age: 26, status: "pending"})
{
        "acknowledged" : true,
        "insertedId" : ObjectId("5a2357d52e5b9ce7b1f669c5")
}
> db.users.find();
"_id" : ObjectId("5a2357d52e5b9ce7b1f669c5"), "name" : "kim""age" : 26"status" : "pending" }
>
cs


use test;

db.some.insert({name: 'kim', age: 30});

db.some.find();


반응형

'엉터리 개발 이야기 > nodejs' 카테고리의 다른 글

성능테스트  (0) 2017.12.01
node.js + express(mvc)  (0) 2017.12.01
node.js testing(assert, mocha)  (0) 2017.12.01
node modules  (0) 2017.11.28
node.js 따라 해보기.  (0) 2017.09.22