setFeatureCompatibilityVersion 4.0 on 4.2 Save still not working

Hello,

we have a mongodb 4.2, the app uses the save method, so we set
setFeatureCompatibilityVersion to 4.0 but still get the Error:

2021-03-24 10:36:49,805 WARN [de.kaufland.ilm.kraken.eventdriven.parser.actor.parse.ParseFileWorker] (pool-4-thread-23) Format KdaImportFormat [importFormatId=‘ImportFormatId(country=MD, source=kpos)’], File 2021/1340/03/24/receipts/2021-03-24T11.36.47+02.00_Transaction_1340_5f1d77d7-5b0c-4b46-b094-33f8a5724155.zip Write failed with error code 61 and error message ‘Failed to target upsert by query :: could not extract exact shard key’; nested exception is com.mongodb.WriteConcernException: Write failed with error code 61 and error message ‘Failed to target upsert by query :: could not extract exact shard key’: org.springframework.dao.DataIntegrityViolationException: Write failed with error code 61 and error message ‘Failed to target upsert by query :: could not extract exact shard key’; nested exception is com.mongodb.WriteConcernException: Write failed with error code 61 and error message ‘Failed to target upsert by query :: could not extract exact shard key’

    at org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:85) [spring-data-mongodb-1.10.11.RELEASE.jar:]

any Idea ?

Regards Karsten

Hi @Karsten_Engstler and welcome in the MongoDB Community :muscle: !

I don’t see the link between the exception you are getting and the feature compatibility. Looks like you have an issue with your shard key instead.

Can you please provide the query and the shard key of the collection you are targeting?

Cheers,
Maxime.

1 Like