Version compare issue
There is a problem with down migration from version 1.0.10 to 1.0.x and then migration up to 1.0.10. Why it happens? because MongoDBMigrations.GetVersion uses Linq and send version compare condition to MongoDB database instead compare versions by C# code. MongoDB see version as a string and knows nothing about Major.Minor.Revision semantic comparison.
The patch with proposed solution is attached. The solution is verified in my environment.
Comments (3)
-
repo owner -
repo owner Dear user,
I reviewed the case you have mentioned, but I have to highlight that MognoDB compares strings perfectly well. The string β1.1.0β obviously greater then β1.0.0β https://stackoverflow.com/a/18061460 This statement has been proved by new unit tests in commitdf76596
.
Moreover I check this fact directly via MongoDB Compass app.As a result, you patch won't be applied. But anyway thanks for your attention. I checked the scenario that you have described, and it is working correctly. Itβs also covered by tests. If this issue still relevant for you please contact me. The root cause definitely not in
MongoDBMigrations.GetVersion
.
Best regards,
Arturβ
-
repo owner - changed status to resolved
Covered by new unit tests
- Log in to comment
Thanks a lot for your attention
I will cover this case by unit tests, review and apply your patch. So this issue will be solved in the next update.