I am having document with array and map fields. When i try to get this in data class some other fields are getting null.
for example - orderQty is getting as null.
CodePudding user response:
At first glance, I can see that the names of the fields in your Orders
class are different than the names that exist in the database. In your class, the fields start with an upper-case letter, while in the database start with a lower-case letter. And this is not correct, the names must match. The simplest solution would be to change the names of the fields in the class. So a field called OrderNo
should be changed to orderNo
. See the lower-case o
?
Alternatively, you can use an annotation like this:
@get:PropertyName("orderNo")
@set:PropertyName("orderNo")
var OrderNo: String? = null,