Open RationalRank opened 1 month ago
➤ PM Bot commented:
Jira ticket: RSTUDIO-536
I haven't been able to reproduce it.
To generate a Realm file with UUID and embedded objects, I have used the following script:
const Realm = require("realm");
const BSON = require("bson");
const Parent = {
name: "Parent",
primaryKey: "key",
properties: {
key: "uuid",
child: "Child",
},
};
const Child = {
name: "Child",
embedded: true,
properties: {
key: "uuid",
value: "string",
},
};
let realm = new Realm({ schema: [Parent, Child] });
realm.write(() => {
realm.create("Parent", { key: new BSON.UUID(), child: { key: new BSON.UUID(), value: "hello world" } } );
});
realm.close();
File was created using Realm JS v12.6.0. I can open the file with Realm Studio v15.0.1 (prompts me to upgrade), and I can access the embedded object.
Can you share either a Realm file or sample Kotlin code to reproduce it?
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.
I haven't been able to reproduce it.
To generate a Realm file with UUID and embedded objects, I have used the following script:
const Realm = require("realm"); const BSON = require("bson"); const Parent = { name: "Parent", primaryKey: "key", properties: { key: "uuid", child: "Child", }, }; const Child = { name: "Child", embedded: true, properties: { key: "uuid", value: "string", }, }; let realm = new Realm({ schema: [Parent, Child] }); realm.write(() => { realm.create("Parent", { key: new BSON.UUID(), child: { key: new BSON.UUID(), value: "hello world" } } ); }); realm.close();
File was created using Realm JS v12.6.0. I can open the file with Realm Studio v15.0.1 (prompts me to upgrade), and I can access the embedded object.
Can you share either a Realm file or sample Kotlin code to reproduce it?
Hi @kneth . Thanks for getting back on this and apologies for the delayed response
I was able to create a minimal reproducible sample. This happens specifically for UUID v1.
We do not generate UUID v1 now on our API, but some of the old data in our system were generated using UUID v1. I don't see this error for the latest data in the system that has unique IDs generated using UUID v4
You can find the reproducible sample on Github here and the realm file here
I'm seeing this issue with UUIDv7. My object is not embedded. For me the bug also only started occuring after migrating from v23 to v24. So possibly it happens for all UUIDv1 and UUIDv7 ids on v24.
Here's the basics of my code, in Kotlin
class MyEntity() : RealmObject {
@PrimaryKey
var _id: RealmUUID = RealmUUID.random()
}
import kotlinx.uuid.UUIDv7
val uuid = UUIDv7(millis)
this._id = RealmUUID.from(uuid.encodeToByteArray())
Describe the bug Receiving this error
BSONTypeError: UUID string representations must be a 32 or 36 character hex string
in multiple scenariosFew things to note:
To Reproduce Steps to reproduce the behavior:
Expected behavior
Screenshots
Versions:
Additional context Stacktrace: