-
-
Notifications
You must be signed in to change notification settings - Fork 505
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
Doctrine\ODM\MongoDB\Persisters\CollectionPersister::deleteCollections don't remove all necessary elements #2195
Comments
Please provide a failing test case as that's too much info in the issue to digest :) You can mimic how ticket related tests are written: https://github.com/doctrine/mongodb-odm/tree/master/tests/Doctrine/ODM/MongoDB/Tests/Functional/Ticket
From which version were you updating? |
We updated up to version 1.3.7 from version 1.2.1, but this code also is available in version 2.* |
Yes but the question in which version it worked differently :) |
In this pull #1948 was changed logic remove elements. Earlier items are removed step by step, now items removed at one step. This is good, but they made a mistake during optimization |
This my mini test. In branch 1.2.x successfully working. In branch 1.3.x don't working.
|
@TvitiDev thanks for the test case! While this won't fix the issue itself, is there any reason you're not using |
Bug Report
Summary
In upgrading version up to 1.3.* in DocumentPersister::handleCollections() method you made optimisation. Now you update the list collections in method CollectionPersister::updateAll() and method CollectionPersister::deleteCollections() remove all elements as one "$unset". But you lost the some paths for remove.
Current behavior and how to reproduce
For example, I have next document:
me need remove:
I expect, what your code remove this element, but your code remove only 'property.1', because variable $paths (line 368 of file CollectionPersister.php) contains next elements:
before execute method excludeSubPaths():
after execute method excludeSubPaths():
This is not correct. You lost 2 path for remove and will remove only 'property.1'
Expected behavior
I see 2 errors:
but contains:
The text was updated successfully, but these errors were encountered: