/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
패스워드 입력칸이 나오면 맥북 패스워드를 입력
mongoDB 설치하기 한 줄씩 입력하기
brew tap mongodb/brew
brew install mongodb-community
brew services start mongodb-community
npm install mongoose
mongoose
의 문서(Document)란?MongoDB에서 가지고 있는 각 데이터 하나하나를 문서(Document)라고 정의합니다.
1개 이상의 Key-Value의 쌍으로 이루어져있습니다.
{
"_id": ObjectId("6682192a1c155bd2f27881"),
"name": "lyw",
}
mongoose
의 컬렉션(Collection)이란?mongoose
의 스키마(Schema)란?null
: null 값과 존재하지 않는 필드null
String
: 문자열“mongoDB”
Number
: 숫자3.14
Date
: 날짜new Date()
Buffer
: 파일을 담을 수 있는 버퍼, UTF-8이 아닌 문자열을 저장0x65
Boolean
: true
or false
true
ObjectId
(Schema.Types.ObjectId) : 객체 ID, 주로 다른 객체를 참조할 때 넣음ObjectId()
Array
: 배열 형태의 값["a", "b", "c"]
mongoose
의 모델(Model)이란?