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
[mongodb] Upgrade DB driver, add more type handlings, fix QuantityType handling #16333
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding the change: I fear that all stored quantity-type will be lost, is that correct? Do we have a chance to convert them or a "compatibilty mode" for accessing them?
@J-N-K @jlaur just created this PR to address a couple of challenges with the current mongodb driver. I created this as draft in the first place, since I plan two more things:
Once done, this should cover a couple of issues. |
You are too fast! I will add something for this as well, just wanted to create the PR already, since there are quite some changes already. And just figured out, that the online build environment does not contain docker, so all tests using "Testcontainers" do fail - too bad, this is a great way to verify the different mongodb versions. |
e243747
to
386cebb
Compare
Signed-off-by: René Ulbricht <rene_ulbricht@outlook.com>
Signed-off-by: René Ulbricht <rene_ulbricht@outlook.com>
…it tests Signed-off-by: René Ulbricht <rene_ulbricht@outlook.com>
…helper, fixing type handling for HSBType, RawType and QuantityType Signed-off-by: René Ulbricht <rene_ulbricht@outlook.com>
…some tests if docker is missing. Signed-off-by: René Ulbricht <rene_ulbricht@outlook.com>
… the data where possible Signed-off-by: René Ulbricht <rene_ulbricht@outlook.com>
Signed-off-by: René Ulbricht <rene_ulbricht@outlook.com>
…toString Signed-off-by: René Ulbricht <rene_ulbricht@outlook.com>
As I don’t expect many users to test this persistence prior to stable. Maybe good to integrate it and get some mileage on both changes. |
...ongodb/src/main/java/org/openhab/persistence/mongodb/internal/MongoDBPersistenceService.java
Outdated
Show resolved
Hide resolved
...e.mongodb/src/main/java/org/openhab/persistence/mongodb/internal/MongoDBTypeConversions.java
Outdated
Show resolved
Hide resolved
...e.mongodb/src/main/java/org/openhab/persistence/mongodb/internal/MongoDBTypeConversions.java
Outdated
Show resolved
Hide resolved
...e.mongodb/src/main/java/org/openhab/persistence/mongodb/internal/MongoDBTypeConversions.java
Outdated
Show resolved
Hide resolved
...e.mongodb/src/main/java/org/openhab/persistence/mongodb/internal/MongoDBTypeConversions.java
Outdated
Show resolved
Hide resolved
...ce.mongodb/src/test/java/org/openhab/persistence/mongodb/internal/DatabaseTestContainer.java
Show resolved
Hide resolved
...tence.mongodb/src/test/java/org/openhab/persistence/mongodb/internal/DataCreationHelper.java
Show resolved
Hide resolved
...e.mongodb/src/main/java/org/openhab/persistence/mongodb/internal/MongoDBTypeConversions.java
Show resolved
Hide resolved
....persistence.mongodb/src/test/java/org/openhab/persistence/mongodb/internal/SetupResult.java
Show resolved
Hide resolved
...tence.mongodb/src/test/java/org/openhab/persistence/mongodb/internal/VerificationHelper.java
Show resolved
Hide resolved
Co-authored-by: J-N-K <github@klug.nrw> Signed-off-by: ulbi <rene_ulbricht@outlook.com>
…hab/persistence/mongodb/internal/DataCreationHelper.java Co-authored-by: J-N-K <github@klug.nrw> Signed-off-by: ulbi <rene_ulbricht@outlook.com>
…xed compiler warnings Signed-off-by: René Ulbricht <rene_ulbricht@outlook.com>
…xed compiler warnings Signed-off-by: René Ulbricht <rene_ulbricht@outlook.com>
…xed compiler warnings Signed-off-by: René Ulbricht <rene_ulbricht@outlook.com>
…e to be more robust and implemented the ModifiablePersistenceService Signed-off-by: René Ulbricht <rene_ulbricht@outlook.com>
This pull request has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/mongo-db-cannot-be-cast-to-class-java-lang-number/153019/2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
…e handling (openhab#16333) * openhab#16308 openhab#16310 Upgraded MongoDB driver, added initial unit tests * openhab#16308 openhab#16310 Refactored the MongoDBPersistence adding helper, fixing type handling for HSBType, RawType and QuantityType * openhab#16308 Added backwardcompatibility for the old way of writting the data where possible * openhab#16308 Added test for larger ImageItems and the limit of 16 MB Signed-off-by: René Ulbricht <rene_ulbricht@outlook.com> Signed-off-by: Jørgen Austvik <jaustvik@acm.org>
[mongodb] Upgrade DB driver, add more type handlings, fix QuanitityType handling
Description
This pull request addresses issues #16308 and #16310, introducing significant updates and improvements to the system:
PR Classification
Goals and Motivation
The main objective is to modernize the MongoDB driver used within our system from the outdated
mongo-java-driver 2.13.1
(2015) to the currentmongo-driver-sync 4.11.1
. This upgrade not only extends support to MongoDB versions 3.6 through 6.0 but also addresses compatibility issues with MongoDB 5.0 and above, which is no longer adequately supported by the old driver.Noteworthy Changes for End Users
mongo-driver-sync 4.11.1
, enhancing support for MongoDB versions 3.6 to 6.0 and ensuring better system performance and reliability.NumberItem
withQuantityTypes
and added support forColorItem
,LocationItem
,ImageItem
,PlayerItem
, andCallItem
, along with their respective state types, enhancing the system's versatility and user experience.Unit Testing Enhancements
Technical Improvements
QuantityType
handling now stores only the number without the unit. This adjustment allows for more seamless integration with external tools that may not support string-based data types.Documentation and Guidelines