I have below code to map the fileds with projection.
private static ProjectionOperation getProjectionOperation() {
Cond conditional = ConditionalOperators.when(Criteria.where("joined.isHeaderDocument").is(Boolean.TRUE)).thenValueOf("documentID").otherwise(null);
ProjectionOperation projectOperation = Aggregation.project(
.and("doc").as("relationshipNumber")
.and(conditional).as("headerForm");
return projectOperation;
I have to return documentID value when isHeaderDocument is true otherwise i should not map the filed “headerForm” . I am getting exception like “null values not supported for conditional operators”. Can any on please help