Trying to get to grips with the new scala driver, and I keep on getting all sorts of errors when composting org.mogodb.scala.Observable. For example:
def just[T](t: T*): Observable[T] = {
new Observable[T] {
override def subscribe(observer: Observer[_ >: T]): Unit = {
for (tee <- t) { observer onNext tee }
observer onComplete()
}
}
}
Then in the console (import Async,and duration._)
scala> Await result ( just(1,2,3,4) toFuture, 3 seconds)
warning: there were two feature warnings; re-run with -feature for details
res4: Seq[Int] = List(1, 2, 3, 4)
The above works, however:
scala> Await result ( just(1,2,3,4) flatMap { i => just(i,i) } toFuture, 3 seconds)
warning: there were two feature warnings; re-run with -feature for details
java.util.NoSuchElementException: None.get
at scala.None$.get(Option.scala:344)
at scala.None$.get(Option.scala:342)
at org.mongodb.scala.internal.FlatMapObservable$$anon$1$$anon$3.onComplete(FlatMapObservable.scala:97)
at com.dinogroup.scarctic.util.package$$anon$1.subscribe(util.scala:14)
Any ideas? This seems like a really simple thing I'm doing - is this a bug or am I just not using this correctly.