ReactiveCollection#get and DocumentNotFoundException

Why does ReactiveCollection#get(String) throw a DocumentNotFoundException on non-existing id instead of just returning an empty Mono?

I can get the result wanted like this

reactiveCollection.get(id).onErrorResume(DocumentNotFoundException.class, (e) -> Mono.empty());

But I would like to understand the reasoning behind this design choice. And I would also suggest adding @throws to the javadoc of ReactiveCollection#get explaining this functionality.

We did this so that all APIs work the same way - you get exceptions in all cases and there is no “oddball”. This also holds true when switching from reactive to blocking API and vice versa - this way it is just more consistent.


Would be nice to have the javadoc for the ReactiveCollection#get explain this! I would think most would expect it to return a Mono.empty()

@Mico_Piira yes good idea, we’ll improve on the javadocs.