Skip to content

AddFieldsOperationBuilder.addFieldWithValueOf should treat String value as Field reference #4933

Closed
@crmky

Description

@crmky

The current implementation treat String value as Fields instead of Field. However org.springframework.data.mongodb.core.aggregation.DocumentEnhancingOperation.computeValue(Object, AggregationOperationContext) doesn't support Fields but only Field, the generated BSON document is incorrect.

I think change this line from:

valueMap.put(field, value instanceof String stringValue ? Fields.fields(stringValue) : value);

to

valueMap.put(field, value instanceof String stringValue ? Fields.field(stringValue) : value);

should fix that issue.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions