Description
I have a POJO that I want to save, with the following methods:
@BsonIgnore
|
public String getSecret() { |
return secret; |
}
|
|
|
@BsonIgnore |
public void setSecret(String secret) { |
this.secret = secret; |
}
|
|
@BsonIgnore |
public void setSecret(Integer i) { |
this.secret = ""+i; |
}
|
This causes an error:
org.bson.codecs.configuration.CodecConfigurationException: Property 'secret' in TestListing, has differing data types: TypeData{type=String} and TypeData{type=Integer}
|
If I change the last method name to "setSecretAsInt", I get this error:
Unable to get value for property 'secretAsInt' in TestListing
|
I can make it work if I then add a dummy getter like this:
public Integer getSecretAsInt() { |
return null; |
}
|
But that's just ugly, and shouldn't be necessary. If a property is marked as ignored, then the serialization code should ignore it, period.
Similar bug (already fixed): https://jira.mongodb.org/browse/JAVA-2620