Skip to content

@Aggregation repository query method causes NullPointerException when the result is empty #3623

Closed
@rootdavinalfa

Description

@rootdavinalfa

Hello,

i'm have an issue regarding usage of Aggregation annotation on spring-data-mongodb

What i'm encounter is

Cannot invoke "org.bson.Document.isEmpty()" because "source" is null

This happen when collection empty (not have any document) but if have an document, i'm not encounter the error.

Here some snippet of code i'm using:

@Aggregation(
        "{" +
                "\$project: { maxid: {\$max: '\$_id'} }" +
                "}"
    )
    fun getMaxUnitID(): String?

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions