codestates / codestates/vting

[ Dev Log ] OverFlowBIN 0331

Open
#85 0 comments 0 reactions 0 assignees View on GitHub
dev_log
Dominant language
TypeScript
Stars
0
Forks
2
PR merge metrics
No merged PRs in 30d

Description

### 오늘 한일
투표 삭제(삭제에 따른 유저 데이트 수정), 비회원 투표 생성(1시간 경과 후 자동삭제)

### 내일 할일
V page(회원, 비회원 분기), voter page(+ 1시간 카운터 데이터 넘기기)

### 느낀점
mongoDB operator를 잘 활용하면 데이터 수정 및 변경이 어렵지 않다.

### 첨부자료 (code or screenshot)
1. user collection에서 vote array 데이터 중 일부 데이터 삭제하기($pull)
```js
await db
.collection("user")
.updateOne(
{ user_id: data.user_id },
{ $pull: { vote: new ObjectId(voteId) } }
);
```

2. Compass에서 TTL 설정하기(자동 삭제)
1) TTL index 설정
![image](https://user-images.githubusercontent.com/87470206/161023826-3bfa53e1-eba7-4eeb-9b56-efc4021eecc7.png)

2) 설정 후 화면
![image](https://user-images.githubusercontent.com/87470206/161023604-d602c166-f808-4143-a9be-9f3e50b59085.png)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.