@Document(collection = "loanDetails")
class LoanDetails {
@Transient
public static final String COLLECTION_NAME = "loanDetails
@Id
String id
String loanId
String loanUUID
String loanStatus
Date loanDateCreated
Date loanLastUpdated
BigDecimal loanAmount //Stores in String
}
I declared a class LoanDetails and a field with BigDecimal type loanAmount in it Whenever i saved some data in this collection
- It get stores as a string in mongo db database
- while getting the records from database i am getting the error of Failed to decode 'LoandDetails'. Decoding 'loanAmount' errored with: readDecimal can only be called when CurrentBSONType is DECIMAL128, not when CurrentBSONType is STRING.
I tried to add annotation over loanAmount field
@Field(targetType = Decimal128) // This also throws error does not contain targetType attribute attached screenshot for the same
BigDecimal loanAmount