I am trying to understand how the asynch java driver for mongodb works from this example:
collection.insertOne(doc, new SingleResultCallback<Void>() {
@Override
public void onResult(final Void result, final Throwable t) {
System.out.println("Inserted!");
}
});
- its said that SingleResultCallback is a functional interface. what does it mean?
- when onResult will be called?
- does any access to the database is with this callback structure ? why do we need it?