Using "refreshSession" in Java

I’d like to issue a “refreshSession” command to the server with the serverSession. Here is what I try in the Java driver:

            BsonDocument uuidDoc = _clientSession.getServerSession().getIdentifier();
            _db.runCommand(new Document().append("refreshSessions", new BsonDocument[] { uuidDoc }));

which leads to:

org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class [Lorg.bson.BsonDocument;.
	at org.bson.codecs.configuration.CodecCache.getOrThrow(CodecCache.java:46) ~[mongo-java-driver-3.11.2.jar:?]

How do I use the refreshSession command in the Java driver correctly? Anyone got an example? I can’t find one on google it seems…

Programming Error… you need to use a List, not an Array. Question solved.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.