Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow atomic $set for hash type fields #1288

Open
tux-rampage opened this issue Nov 30, 2015 · 1 comment
Open

Allow atomic $set for hash type fields #1288

tux-rampage opened this issue Nov 30, 2015 · 1 comment
Labels

Comments

@tux-rampage
Copy link

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).

@malarzm malarzm added the Idea label Nov 30, 2015
@malarzm malarzm added this to the 1.x milestone Nov 30, 2015
@alcaeus alcaeus removed this from the 1.x milestone Jan 15, 2019
@stale
Copy link

stale bot commented Feb 14, 2019

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in a week if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Stale Issues that have not seen any activity in 30 days label Feb 14, 2019
@alcaeus alcaeus removed the Stale Issues that have not seen any activity in 30 days label Feb 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants