问题
Using the Mongo Java Driver version 3.4.2
Trying to perform a find query on a collection that contains around 700 documents has started throwing the following exception.
This did not happen when the collection was smaller.
The limits look to be set during the connection process.
! com.mongodb.MongoInternalException: The reply message length 4812632 is less than the maximum message length 4194304
! at com.mongodb.connection.ReplyHeader.<init>(ReplyHeader.java:74)
! at com.mongodb.connection.InternalStreamConnection.receiveResponseBuffers(InternalStreamConnection.java:498)
! at com.mongodb.connection.InternalStreamConnection.receiveMessage(InternalStreamConnection.java:224)
! at com.mongodb.connection.UsageTrackingInternalConnection.receiveMessage(UsageTrackingInternalConnection.java:96)
! at com.mongodb.connection.DefaultConnectionPool$PooledConnection.receiveMessage(DefaultConnectionPool.java:440)
! at com.mongodb.connection.CommandProtocol.execute(CommandProtocol.java:112)
! at com.mongodb.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:168)
! at com.mongodb.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:289)
! at com.mongodb.connection.DefaultServerConnection.command(DefaultServerConnection.java:176)
! at com.mongodb.operation.CommandOperationHelper.executeWrappedCommandProtocol(CommandOperationHelper.java:216)
! at com.mongodb.operation.CommandOperationHelper.executeWrappedCommandProtocol(CommandOperationHelper.java:207)
! at com.mongodb.operation.CommandOperationHelper.executeWrappedCommandProtocol(CommandOperationHelper.java:113)
! at com.mongodb.operation.FindOperation$1.call(FindOperation.java:516)
! at com.mongodb.operation.FindOperation$1.call(FindOperation.java:510)
! at com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:431)
! at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:404)
! at com.mongodb.operation.FindOperation.execute(FindOperation.java:510)
! at com.mongodb.operation.FindOperation.execute(FindOperation.java:81)
! at com.mongodb.Mongo.execute(Mongo.java:836)
! at com.mongodb.Mongo$2.execute(Mongo.java:823)
! at com.mongodb.OperationIterable.iterator(OperationIterable.java:47)
! at com.mongodb.FindIterableImpl.iterator(FindIterableImpl.java:151)
回答1:
According to your error information, I reviewed the related source codes of MongoDB Java driver which include ReplyHeader.java, and then I think it's a possible compatiblity bug for CosmosDB using MongoDB wire protocol, but I'm not sure for that without reproducing your issue. Please post a feedback to feedback.azure.com to report this issue to help resolving it.
来源:https://stackoverflow.com/questions/45093859/cosmodb-reply-message-length-error-performing-a-find-using-the-mongo-java-driver