File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
mongo/jvm/src/main/scala/com/avsystem/commons/mongo/reactive Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -21,9 +21,11 @@ object ReactiveMongoExtensions extends ReactiveMongoExtensions {
2121 // mongo observable implementation sometimes logs an error on server-closed cursors
2222 private def singleObservable : Task [Option [T ]] = Task .fromReactivePublisher(publisher)
2323
24- def headOptL : Task [ Opt [ T ]] = singleObservable.map(_.toOpt)
24+ // handles both an empty Publisher and and a single null item
2525 def headOptionL : Task [Option [T ]] = singleObservable.map(_.filterNot(_ == null ))
26+ def headOptL : Task [Opt [T ]] = headOptionL.map(_.toOpt)
27+ // can return null if Mongo driver for some reason returns null, intentionally don't want to report failure
2628 def headL : Task [T ] = singleObservable.map(_.get)
27- def completedL : Task [Unit ] = singleObservable .void
29+ def completedL : Task [Unit ] = headOptionL .void
2830 }
2931}
You can’t perform that action at this time.
0 commit comments