Node.js 하는데 같은 오류가 계속 발생합니다. 도와주세요
``` const express = require('express'); const { MongoClient, ObjectId } = require('mongodb'); const app = express(); app.use(express.static(__dirname + '/public')); app.set('view engine', 'ejs'); app.use(express.json()); app.use(express.urlencoded({ extended: true })); let db; MongoClient.connect('mongodb+srv://sikim0721:********@cluster0.tqbj5n0.mongodb.net/?retryWrites=true&w=majority', { useNewUrlParser: true, useUnifiedTopology: true }) .then(client => { console.log('DB 연결 성공'); db = client.db('forum'); app.listen(8082, () => console.log('서버 리스닝 중')); }) .catch(err => console.error('DB 연결 실패: ', err)); app.get('/news', (req, res) => { const postData = { title: 'Node.js기초' }; db.collection('post').insertOne(postData, (err, result) => { if (err) return res.status(500).send('데이터 삽입 오류'); console.log('데이터 삽입 성공: ', result.ops); res.status(200).send('데이터 삽입 성공'); }); }); app.get('/list', async (요청, 응답) => { let result = await db.collection('post').find().toArray(); 응답.render('list.ejs', { 글목록: result }); }); app.get('/time', async (요청, 응답) => { 응답.render('time.ejs', { data: new Date() }); }); app.get('/write', async (요청, 응답) => { 응답.render('write.ejs'); }); app.post('/newpost', async (요청, 응답) => { try { console.log(요청.body); const { title, content } = 요청.body; if (title === '' && content === '') { 응답.send('제목과 내용을 입력하지 않았습니다.'); } else { await db.collection('post').insertOne({ title, content }); 응답.redirect('/list'); } } catch (e) { console.error(e); 응답.status(500).send('서버 에러 발생'); } }); app.get('/detail/:id', async (요청, 응답) => { try { const postId = 요청.params.id; // 숫자 형태의 ID를 ObjectId로 변환 const objectId = new ObjectId(postId); const result = await db.collection('post').findOne({ _id: objectId }); if (!result) { return 응답.status(404).send('게시물을 찾을 수 없습니다.'); } 응답.render('detail.ejs', { result: result }); } catch (err) { console.error(err); 응답.status(500).send('서버 에러 발생'); } }); ``` BSONError: Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer at new ObjectId (/Users/SaintKim/Documents/NodeJs/node_modules/bson/lib/bson.cjs:2055:23) at /Users/SaintKim/Documents/NodeJs/server.js:65:22 at Layer.handle [as handle_request] (/Users/SaintKim/Documents/NodeJs/node_modules/express/lib/router/layer.js:95:5) at next (/Users/SaintKim/Documents/NodeJs/node_modules/express/lib/router/route.js:144:13) at Route.dispatch (/Users/SaintKim/Documents/NodeJs/node_modules/express/lib/router/route.js:114:3) at Layer.handle [as handle_request] (/Users/SaintKim/Documents/NodeJs/node_modules/express/lib/router/layer.js:95:5) at /Users/SaintKim/Documents/NodeJs/node_modules/express/lib/router/index.js:284:15 at param (/Users/SaintKim/Documents/NodeJs/node_modules/express/lib/router/index.js:365:14) at param (/Users/SaintKim/Documents/NodeJs/node_modules/express/lib/router/index.js:376:14) at Function.process_params (/Users/SaintKim/Documents/NodeJs/node_modules/express/lib/router/index.js:421:3) BSONError: Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer at new ObjectId (/Users/SaintKim/Documents/NodeJs/node_modules/bson/lib/bson.cjs:2055:23) at /Users/SaintKim/Documents/NodeJs/server.js:65:22 at Layer.handle [as handle_request] (/Users/SaintKim/Documents/NodeJs/node_modules/express/lib/router/layer.js:95:5) at next (/Users/SaintKim/Documents/NodeJs/node_modules/express/lib/router/route.js:144:13) at Route.dispatch (/Users/SaintKim/Documents/NodeJs/node_modules/express/lib/router/route.js:114:3) at Layer.handle [as handle_request] (/Users/SaintKim/Documents/NodeJs/node_modules/express/lib/router/layer.js:95:5) at /Users/SaintKim/Documents/NodeJs/node_modules/express/lib/router/index.js:284:15 at param (/Users/SaintKim/Documents/NodeJs/node_modules/express/lib/router/index.js:365:14) at param (/Users/SaintKim/Documents/NodeJs/node_modules/express/lib/router/index.js:376:14) at Function.process_params (/Users/SaintKim/Documents/NodeJs/node_modules/express/lib/router/index.js:421:3) 아무리 수정을 많이 해도 결국엔 [nodemon] app crashed - waiting for file changes before starting... 오류와 서버 ObjectId오류가 나온다고만 반복합니다. node.js 기초에서 유저가 /detail/ 뒤에 글_id를 입력해서 get 요청을 보내면 detail.ejs 페이지를 보여주는건데 실행이 안됩니다.. 도와주세요ㅠㅠㅠ