- 
    Type:
Bug
 - 
    Resolution: Duplicate
 - 
    Priority:
Major - P3
 - 
    None
 - 
    Affects Version/s: 4.2.9
 - 
    Component/s: None
 - 
    None
 
- 
        Server Triage
 - 
        ALL
 - 
        None
 
- 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 
This is very similar to SERVER-14322 however I'm in a case where the auto retry should happen from what I understand but it does not.
Error:
E11000 duplicate key error collection: dbName.collectionName index: a_1_b_1 dup key: { a: 31910, b: "2021-09-02T00:00:00Z" }
Indexes
> db.collectionName.getIndexes()
[
	{
		"v" : 2,
		"key" : {
			"_id" : 1
		},
		"name" : "_id_",
		"ns" : "databaseName.collectionName"
	},
	{
		"v" : 2,
		"unique" : true,
		"key" : {
			"a" : 1,
			"b" : 1
		},
		"name" : "a_1_b_1",
		"ns" : "databaseName.collectionName",
		"sparse" : true
	}
]
Commands run (though ReactiveMongo Scala):
> db.collectionName.findAndModify(
  query: { a: 31910, b: "2021-09-02T00:00:00Z" },
  update: { $inc: { c: 1 } },
  new: true
  upsert: true
)
In our use case, 8 commands are sent at the same time and sometimes we get 1 such error (not always).
Current document matching:
> db.collectionName.find({a:31910, b: "2021-09-02T00:00:00Z"})
{ "_id" : ObjectId("613062a3a00a6ac1f7687e5e"), "b" : "2021-09-02T00:00:00Z", "a" : 31910, "c" : 389723 }
Is this expected? Am I missing something?
We can add some retry mechanism in our code but I'd like to understand why the auto retry does not work.
Any comment will be appreciated.
- duplicates
 - 
                    
SERVER-47212 Retry full upsert path when duplicate key exception matches exact query predicate in findAndModify
-         
 - Closed
 
 -         
 
- is cloned by
 - 
                    
SERVER-47212 Retry full upsert path when duplicate key exception matches exact query predicate in findAndModify
-         
 - Closed
 
 -         
 
- related to
 - 
                    
SERVER-14322 Retry on predicate unique index violations of update + upsert -> insert when possible
-         
 - Closed
 
 -