Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- https
- Nodejs
- 생활코딩
- nomadcoder
- Node.js
- mongodb
- it
- ubuntu
- 노마드코더
- MYSQL
- 자바스크립트
- Load Balancer
- nginx
- java
- mongoose
- TypeScript
- CORS
- Joi
- npm
- AWS
- 타입스크립트
- 조건문
- 항해99
- wil
- 프로그래머스
- JavaScript
- 메소드
- elb
- reduce
- JWT
Archives
- Today
- Total
V-logue
[Mongodb]return callback(new error_1.MongoServerError(res.writeErrors[0])); 본문
Error
[Mongodb]return callback(new error_1.MongoServerError(res.writeErrors[0]));
보그 2022. 6. 25. 17:07에... 내 경우에는 이 에러가 기존의
몽고db 아틀라스 내의 users의 데이터에는 nickName으로 키값이 설정되 있었는데,
이번에 새로운 프로젝트를 진행하면서, nickname으로 변경됐기 때문에
schema를 바꿨었는데
새로 등록되는 nickname값과 nickName값이 다르기 때문에 발생했다고 생각해서
아틀라스내의 users폴더를 날려버리고 나서 등록하니 제대로 올라갔다.
return callback(new error_1.MongoServerError(res.writeErrors[0]));
MongoServerError: E11000 duplicate key error collection: test.users index: nickName_1 dup key: { nickName: null }
at C:\Users\wngur\OneDrive\바탕 화면\Nodejs\실전프로젝트\prac\node_modules\mongodb\lib\operations\insert.js:53:33
at C:\Users\wngur\OneDrive\바탕 화면\Nodejs\실전프로젝트\prac\node_modules\mongodb\lib\cmap\connection_pool.js:277:25
at C:\Users\wngur\OneDrive\바탕 화면\Nodejs\실전프로젝트\prac\node_modules\mongodb\lib\sdam\server.js:212:17
at handleOperationResult (C:\Users\wngur\OneDrive\바탕 화면\Nodejs\실전프로젝트\prac\node_modules\mongodb\lib\sdam\server.js:335:20)
at Connection.onMessage (C:\Users\wngur\OneDrive\바탕 화면\Nodejs\실전프로젝트\prac\node_modules\mongodb\lib\cmap\connection.js:222:9)
at MessageStream.<anonymous> (C:\Users\wngur\OneDrive\바탕 화면\Nodejs\실전프로젝트\prac\node_modules\mongodb\lib\cmap\connection.js:63:60)
at MessageStream.emit (node:events:527:28)
at processIncomingData (C:\Users\wngur\OneDrive\바탕 화면\Nodejs\실전프로젝트\prac\node_modules\mongodb\lib\cmap\message_stream.js:132:20)
at MessageStream._write (C:\Users\wngur\OneDrive\바탕 화면\Nodejs\실전프로젝트\prac\node_modules\mongodb\lib\cmap\message_stream.js:33:9)
at writeOrBuffer (node:internal/streams/writable:389:12) {
index: 0,
code: 11000,
keyPattern: { nickName: 1 },
keyValue: { nickName: null },
[Symbol(errorLabels)]: Set(0) {}
}
일종의 db상의 이미 존재하는 key값과 일치하지 않기 때문에 발생했다는
key error이기 때문에
새로운 프로젝트를 진행할 때는 새로운 db를 만들어서
사용하도록 하자!
MongoServerError: E11000 duplicate key error collection:
항해99 관련해서 몽구스를 사용하다가 이런 에러가 발생했다. Model Schema를 수정한 후 새로운 Index Key 값이 생성될 때 생성하려는 데이터가 충돌하면서 발생하는 문제이다. 해결 방법은 index ServerEr
vlogue.tistory.com
참고로 Robo 3T를 이용할때는 위 포스트를 참고해주시면 감사
'Error' 카테고리의 다른 글
[mySQL] er_access_denied_error access denied for user 'root'@'localhost' (using password yes) (0) | 2022.06.28 |
---|---|
[ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client (0) | 2022.06.27 |
triggerUncaughtException(err, true /* fromPromise */); (0) | 2022.06.25 |
MulterError: Unexpected field (0) | 2022.06.18 |
Router.use() requires a middleware function but got a Object (0) | 2022.05.30 |
Comments