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 Submitted
Categories Compass
Created by Guest
Created on Dec 5, 2023

implicit cast based on validation schema

When importing json data containing an ambiguous type (e.g. 0, which can be a double or int32) with a collection that has a validation schema[1] set for a specific type (e.g. double), the server should reference the schema to resolve the type to implicitly cast the value to upon inserting the document. Otherwise, one can have a document fail validation because (in this example) the 0 was cast to an int32 instead of a double. Thanks [1]: https://www.mongodb.com/docs/manual/core/schema-validation/