How to work with update.one() when UpdateWriteResult seems to be deprecated

94 views Asked by At

I am working on a ReactiveMongo upgrade(0.20.X to 1.0.7) and have noticed that when calling update.one() I get a complex return value of Future[(GenericCollection[collection.Pack] with CollectionMetaCommands)#UpdateWriteResult]

import reactiveMongo.api._
import reactivemongo.api.bson._
import reactivemongo.api.bson.collection.BSONCollection

def updateAsFuture(collection: BSONCollection, selector: BSONDocument, modifier: BSONDocument, upsert: Boolean = false, multi: Boolean = false) = {
    collection.update.one(selector, modifier, upsert=upsert, multi=multi).map(f => f)
  }

The insert.one() and delete.one() seem to be working fine, returning Future[WriteResult] matching what the documentation explains.

I am trying to make sense of all these discrepancies. A detailed example of the typing with update.one would be much appreciated

0

There are 0 answers