org.bson.BsonInvalidOperationException

readString can only be called when CurrentBSONType is STRING, not when CurrentBSONType is SYMBOL.

Samebug tips0

We couldn't find tips for this exception.

Don't give up yet. Paste your full stack trace to get a solution.

Solutions on the web12

  • via Unknown by Alexander Azarov,
  • via Unknown by Alexander Azarov,
  • via Stack Overflow by nairod
    ,
  • Stack trace

    • org.bson.BsonInvalidOperationException: readString can only be called when CurrentBSONType is STRING, not when CurrentBSONType is SYMBOL. at org.bson.AbstractBsonReader.verifyBSONType(AbstractBsonReader.java:655) at org.bson.AbstractBsonReader.checkPreconditions(AbstractBsonReader.java:687) at org.bson.AbstractBsonReader.readString(AbstractBsonReader.java:428) at org.bson.codecs.StringCodec.decode(StringCodec.java:35) at org.bson.codecs.StringCodec.decode(StringCodec.java:27) at com.mongodb.DBObjectCodec.readValue(DBObjectCodec.java:306) at com.mongodb.DBObjectCodec.readDocument(DBObjectCodec.java:345) at com.mongodb.DBObjectCodec.decode(DBObjectCodec.java:136) at com.mongodb.DBObjectCodec.decode(DBObjectCodec.java:61) at com.mongodb.connection.ReplyMessage.<init>(ReplyMessage.java:57) at com.mongodb.connection.QueryProtocol.receiveMessage(QueryProtocol.java:290) at com.mongodb.connection.QueryProtocol.execute(QueryProtocol.java:229) at com.mongodb.connection.QueryProtocol.execute(QueryProtocol.java:38) at com.mongodb.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:155) at com.mongodb.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:219) at com.mongodb.connection.DefaultServerConnection.query(DefaultServerConnection.java:166) at com.mongodb.operation.FindOperation$1.call(FindOperation.java:397) at com.mongodb.operation.FindOperation$1.call(FindOperation.java:394) at com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:195) at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:168) at com.mongodb.operation.FindOperation.execute(FindOperation.java:394) at com.mongodb.operation.FindOperation.execute(FindOperation.java:57) at com.mongodb.Mongo.execute(Mongo.java:738) at com.mongodb.Mongo$2.execute(Mongo.java:725) at com.mongodb.FindIterableImpl$FindOperationIterable.first(FindIterableImpl.java:197) at com.mongodb.FindIterableImpl.first(FindIterableImpl.java:140)

    Write tip

    You have a different solution? A short tip here would help you and many other users who saw this issue last week.

    Users with the same issue

    DunmerDunmer
    39 times, last one
    Unknown visitor
    Unknown visitorOnce,