How to use GRIDFSBuckets with KMongo coroutine client

297 Views Asked by At

I am trying to use GRIDFSBuckets in ktor to upload files. I am using KMongo coroutine extension to create my MongoDB client. When calling GRIDFSBucket.create(). Its parameters need a MongoDatabase and bucketName. This is fine but KMongo coroutines creates a CoroutineDatabase not a MongoDatabase that is needed. Is there anyway around this?

enter image description here

1

There are 1 best solutions below

0
On

You can get a MongoDatabase instance from CoroutineDatabase by calling CoroutineDatabase.database. In your case that would be db.database