Minimal reproducible example for Spring Data MongoDB issue #4812
See AggregationContextTest for a minimal sample to reproduce the issue. The test parses a document and then converts it using AggregationContext#getMappedObject
. The test fails, due to the args
array being converted from empty array to null
.
See AggregatorIT for a real life example. The class under test creates an aggregation pipeline via the Aggregation API, which works correctly, and via parsing a json to create a pre-rendered Document
. The latter fails when sent to MongoDB.
A workaround is provided where an unused argument is specified, preventing the conversion to null
.