반응형
message repository에 객체를 하나
const msg: Message = await this.messageRepository.create({
chatRoom: chatRoom,
msg_content: msgContent,
date: new Date(),
userId: userId,
user: user
});
await this.messageRepository.save(msg);
입력하려고 save 메소드를 사용했다.
하지만
connected -EHVSvlQ_9WlCCKeAAAB
UpdateValuesMissingError: Cannot perform update query because update values are not defined. Call "qb.set(...)" method to specify updated values.
at UpdateQueryBuilder.createUpdateExpression (/Users/a/ft_transcendence/packages/backend/src/query-builder/UpdateQueryBuilder.ts:679:19)
at UpdateQueryBuilder.getQuery (/Users/a/ft_transcendence/packages/backend/src/query-builder/UpdateQueryBuilder.ts:53:21)
at UpdateQueryBuilder.getQueryAndParameters (/Users/a/ft_transcendence/packages/backend/src/query-builder/QueryBuilder.ts:507:28)
at UpdateQueryBuilder.execute (/Users/a/ft_transcendence/packages/backend/src/query-builder/UpdateQueryBuilder.ts:142:50)
at updateSubject (/Users/a/ft_transcendence/packages/backend/src/persistence/SubjectExecutor.ts:611:63)
at Array.map (<anonymous>)
at SubjectExecutor.executeUpdateOperations (/Users/a/ft_transcendence/packages/backend/src/persistence/SubjectExecutor.ts:663:34)
at SubjectExecutor.execute (/Users/a/ft_transcendence/packages/backend/src/persistence/SubjectExecutor.ts:148:20)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at EntityPersistExecutor.execute (/Users/a/ft_transcendence/packages/backend/src/persistence/EntityPersistExecutor.ts:194:21)
UpdateValuesMissingError: Cannot perform update query because update values are not defined. Call "qb.set(...)" method to specify updated values.
save 메소드를 쓸 때 이 에러가 났다.
해결
insert 메소드 사용
const msg: Message = await this.messageRepository.create({
chatRoom: chatRoom,
msg_content: msgContent,
date: new Date(),
userId: userId,
user: user
});
await this.messageRepository.insert(msg);
Reference:
https://dev.to/rishit/optimizing-typeorm-tips-from-experience-part-1-dont-use-save-4ke9
반응형
'42seoul > 42seoul_' 카테고리의 다른 글
git rebase 해결 과정 (0) | 2022.09.28 |
---|---|
[Typeorm] UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'tablePath' of undefined (0) | 2022.09.20 |
Install node.js with 42 homebrew in 42 클러스터 맥 (0) | 2022.07.19 |
내가 까먹지 않으려고 쓰는 42 exam 보는 법 (0) | 2022.07.15 |
dockerfile 과정 에러 [apt-get update 관련] E: Unable to fetch some archives maybe run apt-get update (0) | 2022.07.04 |
[Inception 42] In docker-compose.yml file network must be a mapping not a string (0) | 2022.06.21 |
[Inception 42] docker-compose로 wordpress만 올려보기(공식문서 참고) (0) | 2022.06.21 |
[Inception 42] Virtualbox 화면 크기 키우기 (0) | 2022.06.21 |