org.bson.BsonInvalidOperationException: readString can only be called when CurrentBSONType is STRING, not when CurrentBSONType is ARRAY.

sssslide.com | 4 months ago
  1. 0

    Monocleとかいうのがありまして - SSSSLIDE

    sssslide.com | 4 months ago
    org.bson.BsonInvalidOperationException: readString can only be called when CurrentBSONType is STRING, not when CurrentBSONType is ARRAY.
  2. 0

    Monocleとかいうのがありまして

    slideshare.net | 4 months ago
    org.bson.BsonInvalidOperationException: readString can only be called when CurrentBSONType is STRING, not when CurrentBSONType is ARRAY.
  3. 0

    What I tried to do is to run a code from [the documentation|http://mongodb.github.io/mongo-java-driver/3.0/driver/reference/crud/#codecregistry] to use {{BasicDBObject}} in the new CRUD API. My test document contained a BSON symbol and I got an exception where I didn't expect to have one. {code:text} scala> import com.mongodb._ import com.mongodb._ scala> val db = new MongoClient("localhost").getDatabase("test") июл 31, 2015 7:59:31 PM com.mongodb.diagnostics.logging.JULLogger log INFO: Cluster created with settings {hosts=[localhost:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500} db: com.mongodb.client.MongoDatabase = com.mongodb.MongoDatabaseImpl@2ff5be19 scala> июл 31, 2015 7:59:31 PM com.mongodb.diagnostics.logging.JULLogger log INFO: Opened connection [connectionId{localValue:1, serverValue:6}] to localhost:27017 июл 31, 2015 7:59:31 PM com.mongodb.diagnostics.logging.JULLogger log INFO: Monitor thread successfully connected to server with description ServerDescription{address=localhost:27017, type=STANDALONE, state=CONNECTED, ok=true, version=ServerVersion{versionList=[3, 0, 4]}, minWireVersion=0, maxWireVersion=3, electionId=null, maxDocumentSize=16777216, roundTripTimeNanos=560000} scala> scala> db.getCollection("test").find.first июл 31, 2015 7:59:52 PM com.mongodb.diagnostics.logging.JULLogger log INFO: Opened connection [connectionId{localValue:2, serverValue:7}] to localhost:27017 res0: org.bson.Document = Document{{_id=55bb50acb5b97f6d98b6186c, i32=1, s=str, sym=symbol}} scala> db.getCollection("test", classOf[BasicDBObject]).find.first 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) ... 43 elided {code}

    JIRA | 1 year ago | Alexander Azarov
    org.bson.BsonInvalidOperationException: readString can only be called when CurrentBSONType is STRING, not when CurrentBSONType is SYMBOL.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    What I tried to do is to run a code from [the documentation|http://mongodb.github.io/mongo-java-driver/3.0/driver/reference/crud/#codecregistry] to use {{BasicDBObject}} in the new CRUD API. My test document contained a BSON symbol and I got an exception where I didn't expect to have one. {code:text} scala> import com.mongodb._ import com.mongodb._ scala> val db = new MongoClient("localhost").getDatabase("test") июл 31, 2015 7:59:31 PM com.mongodb.diagnostics.logging.JULLogger log INFO: Cluster created with settings {hosts=[localhost:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500} db: com.mongodb.client.MongoDatabase = com.mongodb.MongoDatabaseImpl@2ff5be19 scala> июл 31, 2015 7:59:31 PM com.mongodb.diagnostics.logging.JULLogger log INFO: Opened connection [connectionId{localValue:1, serverValue:6}] to localhost:27017 июл 31, 2015 7:59:31 PM com.mongodb.diagnostics.logging.JULLogger log INFO: Monitor thread successfully connected to server with description ServerDescription{address=localhost:27017, type=STANDALONE, state=CONNECTED, ok=true, version=ServerVersion{versionList=[3, 0, 4]}, minWireVersion=0, maxWireVersion=3, electionId=null, maxDocumentSize=16777216, roundTripTimeNanos=560000} scala> scala> db.getCollection("test").find.first июл 31, 2015 7:59:52 PM com.mongodb.diagnostics.logging.JULLogger log INFO: Opened connection [connectionId{localValue:2, serverValue:7}] to localhost:27017 res0: org.bson.Document = Document{{_id=55bb50acb5b97f6d98b6186c, i32=1, s=str, sym=symbol}} scala> db.getCollection("test", classOf[BasicDBObject]).find.first 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) ... 43 elided {code}

    JIRA | 1 year ago | Alexander Azarov
    org.bson.BsonInvalidOperationException: readString can only be called when CurrentBSONType is STRING, not when CurrentBSONType is SYMBOL.
  6. 0

    Error with mongodb gorm plugin!

    GitHub | 4 months ago | redraushan
    org.bson.BsonInvalidOperationException: readStartArray can only be called when CurrentBSONType is ARRAY, not when CurrentBSONType is DOCUMENT.

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.bson.BsonInvalidOperationException

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

      at org.bson.AbstractBsonReader.verifyBSONType()
    2. MongoDB Java Driver
      AbstractBsonReader.readString
      1. org.bson.AbstractBsonReader.verifyBSONType(AbstractBsonReader.java:655)
      2. org.bson.AbstractBsonReader.checkPreconditions(AbstractBsonReader.java:687)
      3. org.bson.AbstractBsonReader.readString(AbstractBsonReader.java:428)
      3 frames