-
-
Notifications
You must be signed in to change notification settings - Fork 98
Description
The wiki states that
Nitrite will try to migrate your existing database to the latest version on the best effort basis without any guarantee provided you are using the MVStore module.
However, it seems like it fails to migrate document ids correctly. Version 3.x uses a Long to represent the internal document _id. In version 4.x this code changed to use a String instead. When using version 4.x to read a database that was created with version 3.x the following exception occurs when updating a document:
org.dizitart.no2.exceptions.InvalidIdException: Invalid _id found 21601262100400
Test case (includes a v3 database): https://github.com/DarkAtra/nitrite-java/blob/bug/id-migration-for-old-documents-fails/nitrite-mvstore-adapter/src/test/java/org/dizitart/no2/NitriteTest.java#L449-L479
Steps to reproduce:
- create a database with nitrite version 3.x
- create a collection with a single document
- update nitrite to version 4.x
- get the document from the collection and update any field
- invoke
updateto persist the changes - you should now see the above exception
Is this expected? If so, what would be the best way for me to update existing documents so that they function correctly with version 4.x of nitrite?
Metadata
Metadata
Assignees
Labels
Type
Projects
Status