Version compare issue

Issue #12 resolved
Former user created an 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)

  1. Arthur Osmokiesku repo owner

    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.

  2. Arthur Osmokiesku 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 commit df76596.
    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

    β€Œ

  3. Log in to comment