Open
Description
The hash type field does not allow atomic updates for its fields. Only the whole field is updated.
Much as in #1286 this causes data loss when a Document is updated in multiple requests/threads at the same time.
Request 1:
// Assume $object is managed by the document manager and the "hash"
// Property is mapped as field type "hash"
$object->hash['somekey'] = 'foo';
$dm->flush($object);
Request 2:
// Assume $object is the same as in Request 1 (Same _id)
// and was loaded before changes in Request 1 were flushed
$object->hash['someotherkey'] = 'bar';
$dm->flush();
Depending on which flush occurs last, the resulting hash in mongo db will either be { "somekey": "foo" }
or { "someotherkey": "bar" }
, but never { "somekey": "foo", "someotherkey": "bar" }
(which would be expected, since the hash was extended and not replaced in code).