우선 아이디가 저렇게 있고
player1_id = p1, player2_id = p2... 이런식으로 네이밍 압축했음
p1 = 11, p2 = 2, p3 = 1, p4 = 3, p5 = 17... <-- 이렇게 생각하심 됨
저렇게 id가 p1(11)인걸 보내면 당연히 id가 11인 데이터를 잘 가져옴
근데 문제는 p1, p2, p3인거 한꺼번에 find할려고
find랑 $in을 썼는데
순서가 자동으로 sorting이 됨...
나는 위에 사진처럼 받는 게 아닌
0: {_id: "~~~", id: 11, }
1: {_id: "~~~", id: 2, }
2: {_id: "~~~", id: 1, }
이렇게 sorting이 안된 원래 그 자체 데이터를 받아오고 싶음...
https://stackoverflow.com/questions/27966248/keep-the-order-of-list-used-in-in-query-in-mongo
ㅇㅅㅇ
오 함 해봄
await PlayerModel.find({ $or : [ { id: 4 }, { id: 2 }, { id: 11 } ] },
이렇게해도 2 4 11 순으로 받는다 시1발 후... 여튼저튼 질문한 애도 나랑 같은 의도인건 맞네
https://stackoverflow.com/questions/2813884/how-do-you-keep-the-order-using-select-where-in
<--- 이런 식으로 keep the order of list used in $in 찾아봐야겠네
https://stackoverflow.com/questions/22797768/does-mongodbs-in-clause-guarantee-order\
이렇게하니까 해결됐네 후...