Closed
Description
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.