Skip to content
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

Document mapping service property #294

Merged
merged 1 commit into from
Sep 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions kmongo-kdoc/docs/object-mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,15 @@ dependency!
Choose your poison! :)

See also [Performance section](../performance).

## Explicitly defining the ClassMappingTypeService

If you get an error stating "Service ClassMappingTypeService not found", you are probably using KMongo in an environment where your application is loaded at runtime (e.g. Minecraft plugins).

To fix this error, you can set the `org.litote.mongo.mapping.service` property to the qualified class name of the service for the object mapping engine you are using. For kotlinx.serialization this would be the following:

```kotlin
System.setProperty("org.litote.mongo.mapping.service", SerializationClassMappingTypeService::class.qualifiedName!!)
```

For the class for other mappings than in the example above, see which class inherits from `ClassMappingTypeService` in your module.