GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
The ODM doesn't support a single document update for all fields and embedded documents. The current implementation will run different queries for updating a single document and it's embedded documents.
This would certainly help remove queries between the ODM and Mongo and also remove the need to implement rollback functionality if an embedded document fails to insert.
I've created a repository with some scenarios @ https://github.com/jgornick/doctrine-atomic-test.
After speaking with @jwage and @jmikola, it would be nice to be able to specify an atomicUpdate option in the relationship annotation:
/** @ODM\EmbedMany(…, atomicUpdates=true) */
@jgornick have you tried making a patch? If so, could you share problems while building it? How complex is it?
This feature is crucial for my project so I'll probably start working on patch soon. Do you mind if I take your tests and add them in a pull request?
@sokac I'm sorry, but I ended up leaving the company that was working on that project. We ended up moving to a hybrid MySQL/Mongo solution that took care of our needs. However, I still feel like this would be a very useful feature.
I have the same problem for my project, saving a document don't made atomic update. I have update of some field on the document, next update on relation EmbedMany of the document, and finally update that is made by the method preUpdate.
This can cause problem because the update on the document is not atomic.
Closing thanks to #1096