skip to Main Content

Mongodb – Delete nested object with Mongoose and Next js

My route is below: export async function GET() { await connectMongoDB(); const allCargoDetails = await CargoDetails.find(); return NextResponse.json({ allCargoDetails }); } export async function DELETE(request) { const id = request.nextUrl.searchParams.get("id"); await connectMongoDB(); await CargoDetails.findByIdAndDelete(id); return NextResponse.json({ message: "Detaily smazány" });…

VIEW QUESTION
Back To Top
Search