collection.insertOne(doc).results() method is not available

Hi,

here :

collection.insertOne(doc).results();

results() method not available

i’m using - libraryDependencies += “org.mongodb.scala” %% “mongo-scala-driver” % “2.9.0”
results() implicit we block until the observer is completed:

please help me with this.

Hi @venkateswararao_yelu, and welcome to the forum!

The results() is an implicit observer from the mongo-scala-driver example. Generally in the Scala driver examples you can see an import for Helpers which contains this method.

You can find the code on mongo-scala-driver: Helpers.scala:

def results(): Seq[C] = Await.result(observable.toFuture(), Duration(10, TimeUnit.SECONDS))

See mongo-scala-driver: Helpers used in the Quick Tour for more information.

Regards,
Wan.