GridFs error ConnectionNotInitialized: MongoError 'Connection is missing metadata (like protocol

541 views
Skip to first unread message

Isman Usoh

unread,
Aug 21, 2015, 1:19:39 PM8/21/15
to ReactiveMongo - http://reactivemongo.org
i save photo to GridFS

Code:
def doUpload = Action.async(parse.multipartFormData) { request=>
 
import reactivemongo.api.gridfs.Implicits._

  request
.body.file("photo").map { file =>
   
val db = reactiveMongo.connection("photo")
   
val gridFs = GridFS[BSONSerializationPack.type](db)

    gridFs
.save(Enumerator.fromFile(file.ref.file), DefaultFileToSave(file.filename, file.contentType)).map {
      readFile
=>
       
Ok(s"${readFile.id.toString} ${readFile.filename} ${readFile.length}")
   
}
 
}.getOrElse {
   
Ok("Notfound").fuSuccess
 
}
}




Error

Execution exception                

[ConnectionNotInitialized: MongoError['Connection is missing metadata (like protocol version, etc.) The connection pool is probably being initialized.']]

reactivemongo
.core.errors.ConnectionNotInitialized: MongoError['Connection is missing metadata (like protocol version, etc.) The connection pool is probably being initialized.']
    at reactivemongo
.core.errors.ConnectionNotInitialized$.MissingMetadata(errors.scala:67) ~[reactivemongo_2.11-0.11.6.jar:0.11.6]
    at reactivemongo
.api.collections.GenericCollection$$anonfun$insert$1.apply(genericcollection.scala:271) ~[reactivemongo_2.11-0.11.6.jar:0.11.6]
    at reactivemongo
.api.collections.GenericCollection$$anonfun$insert$1.apply(genericcollection.scala:253) ~[reactivemongo_2.11-0.11.6.jar:0.11.6]
    at scala
.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) ~[scala-library-2.11.6.jar:na]
    at scala
.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) ~[scala-library-2.11.6.jar:na]



info:
mongodb 3.0
reactivemongo 0.11.6
playframword 2.4.2


Cédric Chantepie

unread,
Aug 22, 2015, 5:43:56 AM8/22/15
to ReactiveMongo - http://reactivemongo.org
You have to check the ReactiveMongo driver is configured appropriately for the MongoDB and can access it (auth & network).
Reply all
Reply to author
Forward
0 new messages