-
-
Notifications
You must be signed in to change notification settings - Fork 502
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
RemoveElement on sorted collection #623
Comments
This has come up on another issue/PR, but I can't seem to find it at the moment. Sort should really only be used on the inverse side of a ReferenceMany relationship, and in those cases changes to the PersistentCollection itself (not the documents it contains) would be ignored, since there really is no array on the parent document. The problem with sorting in your case is that once the PersistentCollection is initialized, its ordering may immediately differ from what's actually stored in the database. @j: Do you recall the other issue I was thinking of? It might have been one that you were involved with. |
Am am also experiencing this issue. Has there been any resolution to this? |
@Jimgitsit I believe most important part is @jmikola's
and maybe we should throw exception if owning side tries to use this combination? If you really want to stick with sort here try using |
For the record PR I had in mind is #524 |
I have a document Whatever with a collection "users" which reference many User.
This collection is sorted with an annotation.
If I try to delete one user reference from the collection.
The user deleted is not the one I want to delete. There is an issue with the key here because of the sort annotation. The removeElement method should remove the element at the key x based on the order in the database.
Log :
doctrine.INFO: MongoDB query: {"update":true,"query":{"_id":{"$id":"51c4a13ffa4634362a000061"}},"newObj":{"$unset":{"users.2":true}},"options":{"safe":true,"fsync":false,"timeout":30000},"db":"something","collection":"Whatever"}
The text was updated successfully, but these errors were encountered: