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
Created by Guest
Created on Jun 29, 2020

Ignore unmapped fields in pojo deserialization

A recent ticket (00664772) with the mongodb support team confirm that the following case is not handled by the Java driver: class Foo { int x; int y; } I can successfully write and read it. However, if the Document has extra fields, it cannot be deserialized and no option exists to allow this behavior: { x:123, y:456, z:789 } // why can't I ignore 'z'? My suggestion is, provide an annotation to support this behavior: @BsonIgnoreUnmappedFields class Foo { int x; int y; }