Я новичок в драйвере scala mongo. Отсюда следует код вставки документа https://mongodb.github.io/mongo-scala-driver/2.6/reference/crud/
Вот мой код
import com.mongodb.async.client.Observable
import com.mongodb.async.client.Observer
import com.mongodb.async.client.Observer._
import org.mongodb.scala.Completed
import org.mongodb.scala.Completed._
import com.mongodb.async.client.{Observable => JObservable, Observer => JObserver}
import com.mongodb.async.client.Subscription
val document: BsonDocument = new BsonDocument("_id", new BsonString(readOnlyAdmin.uuid))
.append("Email", BsonString(readOnlyAdmin.email))
.append("SecondryEmail", BsonString(readOnlyAdmin.secondryEmail.get))
.append("FirstName", BsonString(readOnlyAdmin.firstName))
.append("LastName", BsonString(readOnlyAdmin.lastName))
.append("Password", BsonString(readOnlyAdmin.password))
.append("Counter", BsonInt32(readOnlyAdmin.counter))
.append("IsNew", BsonBoolean(readOnlyAdmin.isNew))
.append("UserStatus", BsonString(readOnlyAdmin.userStatus.toString()))
.append("UserType", BsonString(readOnlyAdmin.userType.toString()))
val insertObservable: Observable [Completed] =collection.insertOne (document)
insertObservable.subscribe(new Observer[Completed] {
override def onNext(result: Completed): Unit = println(s"onNext: $result")
override def onError(e: Throwable): Unit = println(s"onError: $e")
override def onComplete(): Unit = println("onComplete")
})
и я получаю следующую ошибку
object creation impossible, since method onSubscribe in trait Observer of type (x$1: com.mongodb.async.client.Subscription)Unit is not defined
что мне здесь не хватает?