User Management: getUserSession

I am trying to implement getUserSession. However, as the find method returns iterable interface, how can I cast interface to the session object. The reason for casting is that the return type of getUserSession method is session.


1 Like

Chapter 1: Driver Setup

Using POJO - Part 1 and 2.

I am having the same issue. Here is my code:

public Session getUserSession(String userId) {

    return sessionsCollection.find(Filters.eq("user_id", userId)).first();

I though using this way I would automatically get a session object. But that does not seem to be correct. Any ideas? Any one?

What do you get? Any exception or error message?

Following up here: