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

Mongodb – Node mongo group by specific field

I have a response like this: "data": [ { "_id": "6664a8f2f233916895656171", "workout_plan_id": "6664a5a089450f21a8dd69dc", "day": "Monday", "exercise_id": "66643259d020507ed008b16d", "reps": 15, "sets": 3, "created_on": "2024-06-08T18:54:16.287Z", "updated_on": "2024-06-08T18:54:16.287Z", "__v": 0 }, { "_id": "6664aa55ce325f608597f5e8", "workout_plan_id": "6664a5a089450f21a8dd69dc", "day": "Monday", "exercise_id": "66643259d020507ed008b16d", "reps": 15, "sets":…

VIEW QUESTION

Struggling to upload data onto MongoDB

I am trying to upload data onto my MongoDB Atlas database. The data are .csv files from the Kaggle Movies Dataset https://www.kaggle.com/datasets/rounakbanik/the-movies-dataset. I have tried different methods, but nothing seems to work as it should. Method 1 I first tried…

VIEW QUESTION
Back To Top
Search