MongoDB 소개

Python으로 배우는 MongoDB 입문

Filip Schouwenaars

Machine Learning Researcher

데이터는 어디에나!

데이터는 어디에나.jpg

Python으로 배우는 MongoDB 입문

예시: 학생 과목 데이터

student_id name course_code title
1 Amina CS101 Intro to Coding
1 Amina MATH201 Algebra Basics
2 Luca CS101 Intro to Coding
Python으로 배우는 MongoDB 입문

데이터 저장 방법

학생

student_id name
1 Amina
2 Luca
Python으로 배우는 MongoDB 입문

데이터 저장 방법

학생

student_id name
1 Amina
2 Luca

과목

course_code title
CS101 Intro to Coding
MATH201 Algebra Basics
Python으로 배우는 MongoDB 입문

데이터 저장 방법

학생

student_id name
1 Amina
2 Luca

수강 등록

student_id course_code
1 CS101
1 MATH201
2 CS101

과목

course_code title
CS101 Intro to Coding
MATH201 Algebra Basics

관계형 모델

  • 관계형 데이터베이스에서 사용
  • 예: MySQL, PostgreSQL
Python으로 배우는 MongoDB 입문

관계형 데이터베이스의 한계

 

  • 구조화되고 일관된 데이터에 적합
  • 복잡하고 가변적인 데이터는?
  • 추가 정보에 더 많은 테이블 필요
  • 규모가 커질수록 관리가 어려워짐

개략도

Python으로 배우는 MongoDB 입문

MongoDB 살펴보기

 

  • 테이블이 아닌 문서 기반
  • 유연함: 각 레코드가 달라도 됨
  • 엄격한 스키마 불필요
  • 중첩된 구조 데이터도 쉽게 저장

Python으로 배우는 MongoDB 입문

JSON을 확장한 BSON

 

  • BSON = 이진 JSON
  • 유사하지만 더 빠르고 효율적
  • Date, Binary 같은 추가 타입 제공
  • MongoDB는 내부적으로 BSON 사용

Python으로 배우는 MongoDB 입문

MongoDB에 연결하기

from pymongo import MongoClient

# Create client (localhost) client = MongoClient()
# Create client (remote server) client2 = MongoClient("mongodb+srv://usr:[email protected]")
Python으로 배우는 MongoDB 입문

연습해 봅시다!

Python으로 배우는 MongoDB 입문

Preparing Video For Download...