0

I am trying to create to multiple collections in MongoDB using ReactiveMongo driver in Play Framework.

I am using following configurations:

application.conf: mongodb.uri = "mongodb://localhost:27017/somedb" 

in my controllers class:

def userCollection = reactiveMongoApi.db.collection[BSONCollection]("user")

(I want to store user info in this collection). The code works fine till here. But when i try to add another collection in which i want to store form data of different format.

def formCollection = reactiveMongoApi.db.collection[BSONCollection("form")

and when i run this code, i get the following error:

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

How do i achieve this ??

cchantep
  • 9,118
  • 3
  • 30
  • 41
Manuj Kathuria
  • 1,043
  • 9
  • 13
  • Possible duplicate of [ReactiveMongo ConnectionNotInitialized In Test After Migrating to Play 2.5](http://stackoverflow.com/questions/37191520/reactivemongo-connectionnotinitialized-in-test-after-migrating-to-play-2-5) – cchantep Aug 09 '16 at 06:03
  • You should use `.database` instead of the deprecated `.db` – cchantep Aug 09 '16 at 06:04

0 Answers0