bulk upserts return a private MultiBulkWriteResult

24 views
Skip to first unread message

Tom Howland

unread,
Oct 5, 2023, 2:01:57 PM10/5/23
to ReactiveMongo - http://reactivemongo.org
bulk upserts return a private MultiBulkWriteResult. Consequently, we have flows that have return types that can't be declared.

I bet there is a reason it was designed like this. Does anyone know what that might have been?

Cédric Chantepie

unread,
Oct 8, 2023, 10:57:33 AM10/8/23
to ReactiveMongo - http://reactivemongo.org
There is misunderstanding.

MultiBulkWriteResult is not private, its constructor is (and only the driver can build it).

Anyway, as a type specific to DB, it's not intended to be leaked out in your own API.

Tom Howland

unread,
Oct 8, 2023, 4:19:14 PM10/8/23
to reacti...@googlegroups.com
MultiBulkWriteResult is not private, its constructor is (and only the driver can build it).


image.png

Due to a design flaw, our bulk upsert commands return private instances, preventing the declaration of Flow return values.





--
You received this message because you are subscribed to a topic in the Google Groups "ReactiveMongo - http://reactivemongo.org" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/reactivemongo/OL1SzHFfXeU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to reactivemong...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/reactivemongo/137db3dd-1abf-40a6-82c7-04efcf33cc75n%40googlegroups.com.

Cédric Chantepie

unread,
Oct 9, 2023, 4:56:59 PM10/9/23
to ReactiveMongo - http://reactivemongo.org
final class X private (...) { ... }

Doesn't mean that the class is private.
I suggest you have a look the documentation about Scala class syntax.
Message has been deleted
Message has been deleted

Tom Howland

unread,
Oct 10, 2023, 10:21:18 AM10/10/23
to reacti...@googlegroups.com
It is a design flow

How should I declare my method?

image.png
object Pack is not a member of package reactivemongo.api.bson.collection
import reactivemongo.api.bson.collection.{BSONCollection, Pack}

Cédric Chantepie

unread,
Oct 10, 2023, 10:43:00 AM10/10/23
to ReactiveMongo - http://reactivemongo.org
To do so, you need to work with dependent type.
That's rather a X/Y problem.

You should rather use `val ops = update(false); ops.many(..)` (BTW I doubt mixing JSON as update with BSON as value, and it generally making code overcomplex).
Reply all
Reply to author
Forward
0 new messages