morphia: Reference error
After switching to 2.0 i encountered a problem with references. Getting this error: java.lang.IllegalStateException: unknown type for bson mapping: class com.mongodb.DBRef at dev.morphia.mapping.codec.reader.DocumentReader.getBsonType(DocumentReader.java:347)
I checked the DB and the previous version of morphia would map reference with something like this:
"mediaItem" : {
"$ref" : "MediaItem",
"$id" : {
"className" : "some UID type of class",
"uuid" : "xxxxxxxxxxxxxxxxxxx"
}
}
and now when testing dummy class with the same type reference I get following in DB:
"mediaItem" : {x
"uuid" : "xxxxxxxxxxxxxxxxxxx"
}
Was there a change how @Reference annotation is handled/saved?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 28 (16 by maintainers)
Commits related to this issue
- forward port fix from #1500 fixes #1551 — committed to MorphiaOrg/morphia by evanchooly 3 years ago
Open a new issue please and I’ll try to take a look over the weekend. Thanks.
@evanchooly No need. I was able to go back through my code and found where the error was. Happy to report this works both for morphia 2.1.3 and 2.1.4-SNAPSHOT.
Thank you.
Hi, I tested both the test repo and our own project. The issue looks fixed in the test repo. In our own project we are still getting: Exception in thread “main” java.lang.IllegalStateException: unknown type for bson mapping: class com.mongodb.DBRef