Description
The current PartialValueStrategy creates full documents which are then used in the ReplaceOneBusinessKeyStrategy. This is fine if the document are an exact match, but if there are extra fields in a document then there won't be a match, which can lead to duplicate key errors.
MongoDB Enterprise > db.test.insert({"a": {"a1": 1}, b: {b1: 1, b2: 1}})
|
MongoDB Enterprise > db.test.insert({"a": {"a1": 1}, b: {b1: 1, b2: 1, c1: 1}})
|
|
|
// Document notation matches one record
|
MongoDB Enterprise > db.test.find({a: {a1: 1}, b: {b1: 1, b2: 1}})
|
{ "_id" : ObjectId("5f5740a32d2c3b0aec9e0e49"), "a" : { "a1" : 1 }, "b" : { "b1" : 1, "b2" : 1 } }
|
|
|
// Dot notation matches all records.
|
MongoDB Enterprise > db.test.find({"a.a1": 1, "b.b1": 1, "b.b2": 1})
|
{ "_id" : ObjectId("5f5740a32d2c3b0aec9e0e49"), "a" : { "a1" : 1 }, "b" : { "b1" : 1, "b2" : 1 } }
|
{ "_id" : ObjectId("5f5740a92d2c3b0aec9e0e4a"), "a" : { "a1" : 1 }, "b" : { "b1" : 1, "b2" : 1, "c1" : 1 } }
|