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 Future Consideration
Created by Raschid Jimenez
Created on May 21, 2026

Add first-class support for Zod-derived JSON schema for validators in collection creation/modification

What problem are you trying to solve?

Focus on the what and why of the need you have, not the how you'd like it solved.

We use Zod schemas in our Node.js/TypeScript applications as the source of truth for validating application data, but MongoDB collection validators use a different and more limited $jsonSchema dialect. This creates a gap between application-level validation and database-level validation, forcing us to maintain separate schema definitions or introduce custom conversion logic.

What would you like to see happen?

Describe the desired outcome or enhancement.

We would like the MongoDB Node.js driver to support using a Zod schema or its generated JSON Schema directly when creating or modifying collection validators, with MongoDB-compatible translation or clear errors when parts of the schema cannot be preserved safely.

Why is this important to you or your team?

Explain how the request adds value or solves a business need.

This would let us use a single source of truth for schema validation across both the application and the database. It would reduce duplicated effort, lower the risk of mismatched validation behavior, and avoid situations where unsupported JSON Schema keywords are silently ignored and important constraints are lost.

What steps, if any, are you taking today to manage this problem?

Today, we either build and maintain our own conversion layer or rely on third-party libraries to transform standard JSON Schema into something MongoDB can use for $jsonSchema validation. This adds maintenance overhead and creates uncertainty about which constraints are actually enforced.


  • Admin
    Raschid Jimenez
    Jun 8, 2026

    Creating this ticket to track the idea reported in NODE-7579