에러 메세지
Unhandled Runtime Error
Error: Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer
페이지 라우팅 폴더
app/list/[id]
리스트에도 페이지가 있고, [id]에도 페이지 만들었습니다.
다이나믹라우팅 폴더의 페이지 컴포넌트에서 parmas 콘솔시, 파람값이 잘 출력이 되어서,
데이터만 뽑아서 바인딩 해주면 되는데, 몽고디비에서 파인드원, 오브젝트아이디가 뽑히질않아요 뉴뉴
오류 검색했을때 오브젝트아이디가 맞지 않는 형식이다라고 하는데 아무리해도 안되네요
타입스크립트 설치안했고 나머지는 설치하긴했는데 이게 문제일까요?
import { ObjectId } from 'mongodb';
import { connectDB } from '../../../../util/database';
export default async function Detail(props) {
let db = (await connectDB).db('forum');
let result = await db
.collection('post')
.findOne({ _id: new ObjectId(props.params.id) });
return (
<div>
<h4>상세페이지임</h4>
<h4>{result.title}</h4>
<p>{result.content}</p>
</div>
);
}