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?
Asked
Active
Viewed 213 times
1

EmmaneulO1
- 63
- 1
- 5
-
Here you can find an example code to store a binary file https://stackoverflow.com/a/69162729/13963150. It probably works only with `org.litote.kmongo:kmongo`. – Aleksei Tirman Dec 07 '21 at 07:16
1 Answers
0
You can get a MongoDatabase
instance from CoroutineDatabase
by calling CoroutineDatabase.database
. In your case that would be db.database

Racka98
- 500
- 5
- 8