Hello @Zdziszkee_N_A,
… how to get the document from db when
collection.find().first().subscribe(subscriber);returnsPublisher?
collection.find().first() returns a org.reactivestreams.Publisher<TResult>.
The Publisher’s subscibe(Subscriber<? super T> s) method “Requests Publisher to start streaming data.” - it doesn’t return a Publisher.
The tutorial’s examples have a subscriber defined; use that code. There is an example PrintSubscriber, and this can be used to print the find query result.
The SubscriberHelpers is a utility class shown with the examples. It is used as shown in the Quick Tour. The source code for the SubscriberHelpers.java can be found on GitHub: mongo-java-driver-reactivestreams/examples/tour/src/main/tour at master · mongodb/mongo-java-driver-reactivestreams · GitHub. You can use it with your program.
Also if all actions are performed async how to make it sync ?
I guess, you can try using the synchronous Java APIs for those .