Skip to Main Content

MongoByte MongoDB Logo

Welcome to the new MongoDB Feedback Portal!

{Improvement: "Your idea"}
We’ve upgraded our system to better capture and act on your feedback.
Your feedback is meaningful and helps us build better products.

Status Planned
Categories Compass
Created by Guest
Created on Jul 14, 2020

Explain why "Document failed validation"

When saving a document fails, and the error "Document failed validation" is raised, it would be incredibly useful to know in what way the document does not match the validation schema. There's a whole meme at my company about this error and the hours we waste chasing down the various causes. Yes I'm aware of the "application validation" argument. We do it too. But we have big documents, big collections, and frequent schema migrations; there's going to be issues. Compass does not access MongoDb though our application, so it seems like the right place to be able to know "why". TL;DR I might get back years of my life if Compass could just tell me why documents fail validation instead of obtusely repeating "Document failed validation" as I trial and error my way to an early grave.
  • Attach files
  • Guest
    Jan 30, 2023
    At time of writing, Mongo Compass 1.35 with MongoDB 5.0.x doesn't give details as to why the document failed validation, have to use the command-line (mongosh) to get the details[1], which is important for any sufficiently advanced document. The feature described would useful! Thanks! [1] https://www.mongodb.com/developer/products/mongodb/mongodb-5-0-schema-validation/
  • Guest
    Aug 18, 2021
    With v5 there are no reasons to not have this implemented.
  • Guest
    Aug 13, 2021
    Now that with version 5.0 the validation schema errors are returned by Mongo, can the functionality be implemented in Compass?
  • Guest
    Aug 21, 2020
    I investigated this further. Looks like the server does not return the reason for the document to be invalid. The server team is working on it, targeting MongoDB 4.6: https://jira.mongodb.org/browse/SERVER-20547. Once that is available in the server's response, we will surface it in Compass.
  • Guest
    Jul 15, 2020
    Thank you for the feedback. Let us see what we can do about this. If the server gives us more information back along with the error we can see how to surface it best in the UI.