Statics
Model에는 instance method 말고도 static functions가 있다. 잠깐 설명을 하자면 javascript 클래스에는 static이라는 개념이 있다. 일반적으로 method를 클래스에 선언하면 그 method의 this는 인스턴스에 바인딩된다. static method에서 this는 클래스 그 자체에 바인딩된다. schema 정의. const animalSchema = new Schema({ name: String, breed: String }) static method 정의. // Assign a function to the "statics" object of our animalSchema animalSchema.statics.findByName = function (name) {..
Mongoose/schemas
2020. 3. 9. 15:57
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 자료구조
- mixin
- map
- query helper
- resave
- set
- 집합
- mongoose
- instance method
- virtuals
- 선형리스트
- Generator
- javascript
- static method
- 자료구조 #딕셔너리 #해시
- MongoDB
- express-session
- 맵
- saveUnitialized
- 다형성
- 이중 연결리스트
- alias
- index
- Node.js
- 다중상속
- pm2 #cluster #Javascript
- Iterator
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
글 보관함