[JAVA-4475] 'Failed to target upsert by query :: could not extract exact shard key', details={}}.; nested exception is com.mongodb.MongoWriteException: Created: 04/Feb/22 Updated: 22/Jun/22 Resolved: 04/Feb/22 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Question | Priority: | Major - P3 |
| Reporter: | Danny Pandit | Assignee: | Jeffrey Yemin |
| Resolution: | Won't Do | Votes: | 0 |
| Labels: | external-user | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
Hii, We are getting exceptions while hitting upsert queries on sharded collection with above mentioned error There is way to insert shard key in query filter but that is not feasible for us, hence we tried adding @Sharded annotations to our DTO as we have different shard keys for different collections Still we are getting the above mentioned error also we are unable to get exact meaning of what is full copy of entity meant in below statement update/upsert operations replacing/upserting a single existing document as long as the given UpdateDefinition holds a full copy of the entity. Other queries are working fine also upsert queries are working fine on addition of shard key in query filter but that change is not feasible for us we need quick solution Please help as not able to find any solution on any platform. Thanks in advance!
|
| Comments |
| Comment by Danny Pandit [ 05/Feb/22 ] |
|
Could you atleast help me with the usage of @Sharded annotation how it can be used to hit upsert on sharded collections. |
| Comment by Jeffrey Yemin [ 04/Feb/22 ] |
|
With the information you've provided so far, it's going to be difficult to make progress. It's not clear exactly how to reproduce the issue, and it's also not clear whether the issue is with the driver, spring data, or the server, since all three were upgraded. I suggest that you create a minimal reproducible example that works as expected, then upgrade one component at a time (server, driver, spring data) until it starts to fail, then post all the information to one of these places:
|
| Comment by Danny Pandit [ 04/Feb/22 ] |
|
Yes. Facing this issue specifically after mongo driver and server upgrade. Also even the solution of using @Sharded annotation is not working other solution is to add shard key to query filters is not feasible to us. |
| Comment by Jeffrey Yemin [ 04/Feb/22 ] |
|
Sorry to hear you are having trouble. Can you clarify whether you have evidence that the Java driver or Spring Data upgrade is the root cause of the error? i.e. are you saying that everything was working before the upgrade and after the upgrade you are getting the error? Or is the upgrade unrelated to the error? Thanks, |