Skip to content

Embedded sharding keys are not correctly picked up from the shardKeySource Document #3590

Closed
@christian-german

Description

@christian-german

The annotation @Sharded(shardKey = {...}) add some filters to the request performed upon MongoDB when updating a document (upsert).

If we use composite keys like "location.locationId", the value from the Document we store is not retrieved, due to the Document not being "flatted".
This is done in the applyShardKey method, in the UpdateContext inner class within the QueryOperations class:
getMappedShardKeyFields(domainType).forEach(key -> filterWithShardKey.putIfAbsent(key, shardKeySource.get(key)));

See this question on SO.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions