![](http://i1.daumcdn.net/thumb/C148x148.fwebp.q85/?fname=https://blog.kakaocdn.net/dn/nbgms/btqCDlF5s9s/61ABzKlqH7fLOjBIODUV7K/img.png)
Mongoose에서 인덱스를 선언하는 방법은 2가지가 있다. path level(또는 field level)에서 정의하는 법과 schema level에서 정의하는 법. 스키마를 정의하면서 field level에서 정의할 수 있고, schema정의가 끝나고 index() 메서드를 통해서 정의할 수도 있다. compound index를 만드려면 index() 메서드를 사용해야 한다. const animalSchema = new Schema({ name: String, type: String, tags: { type: [String], index: true } // field level }); animalSchema.index({ name: 1, type: -1 }); // schema level const ..
Mongoose/schemas
2020. 3. 9. 17:45
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- mixin
- virtuals
- 다형성
- Generator
- instance method
- alias
- resave
- static method
- javascript
- query helper
- 다중상속
- mongoose
- 자료구조 #딕셔너리 #해시
- 맵
- 이중 연결리스트
- Node.js
- Iterator
- saveUnitialized
- 선형리스트
- set
- 집합
- MongoDB
- express-session
- index
- map
- 자료구조
- pm2 #cluster #Javascript
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함