Super strange… I would not expect these results. Sorry you’re having this trouble. If it were me, I’d start introducing console.logs…

Try running these checks:

console.log("Request Body Before Insert:", requestBody);
console.log("Generated Data:", data);
console.log("Existing Documents:", await db.collection("ewan").find().toArray());

This will help us confirm:

  • What’s actually being inserted?
  • Is _id being overwritten?
  • What exists in the collection before inserting?
1 Like