일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- 김양재 목사
- No SQL
- 몽고디비
- 빅데이타
- 주일설교
- 인공지능
- Deep learning
- 빅데이터
- Statistics
- 딥러닝
- Machine Learning
- 빅 데이터
- data science
- WebGL
- Big Data
- 통계
- 빅 데이타
- c++
- 우리들교회
- 데이터 과학
- openCV
- probability
- Artificial Intelligence
- nodeJS
- MongoDB
- R
- 김양재
- 김양재 목사님
- node.js
- 확률
Archives
- Today
- Total
Scientific Computing & Data Science
[MongoDB] Basic / Life Cycle for MongoDB 본문
Written by cinema4d
다음 코드는 MongoDB에 대한 라이프 사이클의 한 예를 보여주고 있다:
// user DB "foobar"
use foobar
// define user1
var user1 = {"username" : "gchoi"}
user1.relationships = {"friends" : 100, "enemies" : 1}
// define user2
var user2 = {"username" : "tjkwak"}
user2.relationships = {"friends" : 50, "enemies" : 5}
// define user3
var user3 = {"username" : "jmpark"}
user3.relationships = {"friends" : 10, "enemies" : 3}
// define user4
var user4 = {"username" : "jhlee"}
user4.relationships = {"friends" : 1, "enemies" : 300}
// insert users into "users" collection of DB "foobar"
db.users.insert(user1)
db.users.insert(user2)
db.users.insert(user3)
db.users.insert(user4)
// show users collection
db.users.find()
// show db stats
db.stats()
// change username of user4
user4.username = "hskim"
// change the numbner of friednds
user4.relationships.friends = 5
// change the number of enemies
user4.relationships.enemies = 500
db.users.update({"username" : "jhlee"}, user4)
// show users collection
db.users.find()
// drop the collection "users"
db.users.drop()
// drop the current database
db.dropDatabase()
// show database stats - nothing to show
db.stats()
// shutdown the server
use admin
db.shutdownServer()
'Data Science > MongoDB' 카테고리의 다른 글
[MongoDB] Update Modifiers / Part.1 - $inc (0) | 2014.01.19 |
---|---|
[MongoDB] Updating Documents by Document Replacement (0) | 2014.01.19 |
[MongoDB] MongDB 기본명령어 (0) | 2014.01.13 |
[MongoDB] MongoDB Shell (0) | 2014.01.13 |
[MongoDB] MongoDB 시작하기 (0) | 2014.01.13 |
Comments