I have a bunch of Document in a Collection and would like to retrieve all of them. This is my situation:
- I am using the Java Reactive Streams driver
- I am using the
CodecRegistryto get myDocumentdeserialized to myPojo
The problem is that all flavours of the find() method returns a FindPublisher<Pojo> and needlessly to say that any kind of value emission will result in the returning of Pojo object. I want a List<Pojo> or a Set<Pojo> returned. How do I return a List<Pojo or a Set<Pojo>?
In the quickstart, they are using the find().first() which returns a single Document and hence a single Pojo object makes sense. There is no example for returning multiple Document.
Using MongoDB Reactive Streams Driver and RxJava, for example:
[EDIT ADD] You can use a non-blocking call, for example: