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

Mapping arrays of objects conditionally in Javascript

I have array of objects with a multi-level nesting. const switches = [{ orgId: "1111a7cd-0d58-11ef-83a2-06a19a0b1f5d", orgName: "Management 1", orgType: 2, organisations: [], features: [{ name: "AdvancedAdminApprovalLevels", type: "feature", category: "Management Features", value: false, }, { name: "AdminCategoryApprovalByRole", type: "feature", category:…

VIEW QUESTION
Back To Top
Search