snowdrop-zen / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
1 stars 0 forks source link

Can't use MongoDB with Panache with multiple clients on the same instance #151

Closed snowdrop-bot closed 3 years ago

snowdrop-bot commented 4 years ago

Describe the bug I have a MongoDB instance and several databases. I don't manage to use MongoDB with Panache for several entities on different databases.

Here a simplified version of my Kotlin code :

@MongoEntity(clientName = "db1", collection = "c1")
data class C1 @BsonCreator constructor(
  @BsonId var id: ObjectId = ObjectId()
) : PanacheMongoEntityBase()

My application.properties:

quarkus.mongodb.db1.connection-string=mongodb://127.0.0.1:27017
quarkus.mongodb.db1.database=db1-name

I have the following error:

org.jboss.resteasy.spi.UnhandledException: java.util.NoSuchElementException: Property quarkus.mongodb.database not found

I was expected that the database name was retrieved from quarkus.mongodb.db1.database. Am I missing something?

To Reproduce Here is a reproducer

Environment (please complete the following information):


https://github.com/quarkusio/quarkus/issues/10812


$upstream:10812$