mongodb
MongoDB TLS/SSL connection error
MongoDB.*SSL.*TLS.*error|certificate.*verify|UNABLE_TO_VERIFY_LEAF_SIGNATURE
Fixes
- 1.Add tls=true&tlsCAFile=path/to/ca.pem to connection string for Atlas
- 2.For self-signed certs in dev, use tlsAllowInvalidCertificates=true
- 3.Ensure Node.js trusts the CA — set NODE_EXTRA_CA_CERTS env variable
mongodbtlsconnection
Related Errors
mongodb3 fixes
MongoDB duplicate key violation
E11000 duplicate key error
- •Check for existing documents before insert, or use upsert
- •Verify your unique index fields don't have null values creating conflicts
mongodb3 fixes
Mongoose required field validation error
ValidationError.*Path.*is required|validation failed.*required
- •Ensure all required fields defined in schema are provided before save()
- •Check for typos in field names — Mongoose silently ignores unknown fields
mongodb3 fixes
Mongoose CastError invalid ObjectId
CastError.*Cast to ObjectId failed
- •Validate the ID format before querying: mongoose.Types.ObjectId.isValid(id)
- •Check route params aren't receiving unexpected values (e.g., 'favicon.ico')