-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
랜덤 비디오 응답 시 중복 제거 #131
랜덤 비디오 응답 시 중복 제거 #131
Conversation
'actions.seed': 1, | ||
}, | ||
}, | ||
{ $replaceRoot: { newRoot: '$actions' } }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[{
_id:
actions : [
videoId: ,
seed: ,
]
}]
형태를
[{
videoId: ,
seed: ,
}]
로 바꾸기 위한 연산이에요
const otherSeedIdList = _.sampleSize( | ||
_.reject(actions, { seed }).map((userAction) => userAction.videoId), | ||
lackVideoCount, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sampleSize(list, size)는 list에서 size개를 랜덤으로 샘플링한 리스트를 반환해요
_id: { $in: otherSeedIdList }, | ||
}, | ||
{}, | ||
{ lean: true }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lean을 true로 해주면 find의 결과가 Document인스턴스의 리스트가 아니라 javascript object의 리스트가 됩니다. 즉, toObject()를 쿼리단에서 수행하는거죠
resolved: #130
작업 내용
전달 사항