Connecting to a MongoDB Instance Using KMongo
Often, the seemingly simple things can make you spend hours chasing around your tail. Like trying to connect to a MongoDB instance using KMongo.
Basically, if you have checked out the KMongo quick start, setting up a client and fetching some data should be extremely easy:
val client = KMongo.createClient() //get com.mongodb.MongoClient new instance val database = client.getDatabase("test") //normal java driver usage val col = database.getCollection<Jedi>() //KMongo extension method The quick start tutorial assumes that your DB resides on mongodb://localhost:27017, but in reality, your MongoDB connection string looks more like this: