Skip to content

Kotlin Fluent API extensions do not allow projections with find queries [DATAMONGO-2086] #2953

Closed
@spring-projects-issues

Description

@spring-projects-issues

Mark Paluch opened DATAMONGO-2086 and commented

Kotlin extensions for ExecutableFindOperation and ReactiveFindOperation use the same generic type for the currently used type of the fluent API instance and the new (desired) type:

 

ReactiveFindOperation.FindWithProjection<T>.asType(resultType: KClass<T>): ReactiveFindOperation.FindWithQuery<T>

The left hand side should rather declare a wildcard to ignore the current type and only infer the desired target type:

ReactiveFindOperation.FindWithProjection<*>.asType(resultType: KClass<T>): ReactiveFindOperation.FindWithQuery<T>

to allow projections:

operations.query<Person>()
				.asType<FirstnameOnly>()
				.matching(query(where("firstname").isEqualTo("Walter")))
				…

Affects: 2.1 RC2 (Lovelace), 2.0.10 (Kay SR10)

Referenced from: pull request #609

Backported to: 2.0.11 (Kay SR11)

Metadata

Metadata

Assignees

Labels

in: coreIssues in core supporttype: bugA general bug

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions