Created
April 4, 2013 12:44
-
-
Save Narigo/5310068 to your computer and use it in GitHub Desktop.
This works if you change line 10 (var dbVar = database) to val dbVar = database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Set the project name to the string 'My Project' | |
name := "SBTProject" | |
// The := method used in Name and Version is one of two fundamental methods. | |
// The other method is <<= | |
// All other initialization methods are implemented in terms of these. | |
version := "1.0" | |
scalaVersion := "2.10.1" | |
resolvers += "Sonatype Snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/" | |
resolvers += "Typesafe Stack" at "http://repo.typesafe.com/typesafe/releases/" | |
libraryDependencies ++= Seq( | |
"org.reactivemongo" %% "reactivemongo" % "0.9-SNAPSHOT", | |
"play" %% "play-iteratees" % "2.1.0" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> run | |
[info] Compiling 1 Scala source to /home/joern/Desktop/reactivemongo/target/scala-2.10/classes... | |
[error] /home/joern/Desktop/reactivemongo/test.scala:11: type mismatch; | |
[error] found : reactivemongo.api.collections.default.BSONCollectionProducer.type | |
[error] required: reactivemongo.api.CollectionProducer[C] | |
[error] Error occurred in an application involving default arguments. | |
[error] val collection = dbVar("somecollection") | |
[error] ^ | |
[error] one error found | |
[error] (compile:compile) Compilation failed | |
[error] Total time: 4 s, completed Apr 4, 2013 2:42:40 PM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Main { | |
def main(args: Array[String]) { | |
import reactivemongo.api.MongoDriver | |
import scala.concurrent.ExecutionContext.Implicits.global | |
val driver = new MongoDriver() | |
val connection = driver.connection(List("localhost:27017")) | |
val database = connection("test") | |
var dbVar = database | |
val collection = dbVar("somecollection") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment