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;
}
1
vote
John
shared this idea