I have a java pojo created by jsonSchemaPojo2 as so:
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
@JsonPropertyOrder({
"CardBranding"
})
public class RewardsProcessing implements Serializable
{
@JsonProperty("CardBranding")
@NotNull
private String cardBranding
public RewardsProcessing(String cardBranding){
this.cardBranding = cardBranding
}
@JsonProperty("CardBranding")
public String getCardBranding(){return cardBranding; }
@JsonProperty("CardBranding")
public void setCardBranding(String cardBranding){ this.cardBranding = cardBranding}
}
Rewards Collection:
[
{CardBranding : "1"},
{CardBranding : "2"}
]
The following code parses the mongo response into the java pojo
AggregationResults results = mongoTemplate.aggregate(agg, "Rewards", RewardsProcessing.class);
The problem is that I am getting null in the resulting java object. aggregate is case sensitive.
I have two options:
Make the cardBranding field upper-case by using some property in the jsonschemapojo2. I tried researching but found none. Schemapojo2 by default sets the field to lowerCase.
Configure the aggregate method to ignore the case.
Thanks in Advance!!