getUserSession error

Hi,

I believe I have implemented getUserSession() correctly. But I kept getting errors about incompatible types and it wants me to cast the object to Document which is incorrect because the method should return a Session object instead. Here is the screenshot, any clues to mitigate this?

Please share the declaration of sessionsCollection?

Sure, it has been defined already.

private final MongoCollection sessionsCollection;
sessionsCollection = db.getCollection(“sessions”);

Nevermind, fixed it. Somehow the datatype was predefined as “Document” instead of “Session”. Caught me off guard.
private final MongoCollection < Document> sessionsCollection -> private final MongoCollection < Session> sessionsCollection;