summaryrefslogtreecommitdiff
path: root/src/mongo/client
diff options
context:
space:
mode:
authorTess Avitabile <tess.avitabile@mongodb.com>2016-08-22 14:49:31 -0400
committerTess Avitabile <tess.avitabile@mongodb.com>2016-09-02 15:10:30 -0400
commitf288ea86db58c6aefe4807ed7ac1815577da2752 (patch)
treedadff64105fe94dfeef57c00a38c1e4ff960ca07 /src/mongo/client
parentaa7411e6e2c4fd18bbff934c57567d89dc3efa0e (diff)
downloadmongo-f288ea86db58c6aefe4807ed7ac1815577da2752.tar.gz
SERVER-25159 Default BSON validation version should depend on admin.system.version
Diffstat (limited to 'src/mongo/client')
-rw-r--r--src/mongo/client/dbclientcursor.cpp13
-rw-r--r--src/mongo/client/dbclientcursor.h1
2 files changed, 8 insertions, 6 deletions
diff --git a/src/mongo/client/dbclientcursor.cpp b/src/mongo/client/dbclientcursor.cpp
index 2b534defbba..325fa9c9fbd 100644
--- a/src/mongo/client/dbclientcursor.cpp
+++ b/src/mongo/client/dbclientcursor.cpp
@@ -40,6 +40,7 @@
#include "mongo/rpc/factory.h"
#include "mongo/rpc/get_status_from_command_result.h"
#include "mongo/rpc/metadata.h"
+#include "mongo/rpc/object_check.h"
#include "mongo/rpc/request_builder_interface.h"
#include "mongo/s/stale_exception.h"
#include "mongo/stdx/memory.h"
@@ -346,12 +347,11 @@ BSONObj DBClientCursor::next() {
uassert(13422, "DBClientCursor next() called but more() is false", batch.pos < batch.nReturned);
+ auto status = validateBSON(batch.data, batch.remainingBytes, _enabledBSONVersion);
uassert(ErrorCodes::InvalidBSON,
- "Got invalid BSON from external server while reading from cursor.",
- validateBSON(batch.data,
- batch.remainingBytes,
- enableBSON1_1 ? BSONVersion::kV1_1 : BSONVersion::kV1_0)
- .isOK());
+ str::stream() << "Got invalid BSON from external server while reading from cursor"
+ << causedBy(status),
+ status.isOK());
BSONObj o(batch.data);
@@ -510,7 +510,8 @@ DBClientCursor::DBClientCursor(DBClientBase* client,
resultFlags(0),
cursorId(cursorId),
_ownCursor(true),
- wasError(false) {}
+ wasError(false),
+ _enabledBSONVersion(Validator<BSONObj>::enabledBSONVersion()) {}
DBClientCursor::~DBClientCursor() {
kill();
diff --git a/src/mongo/client/dbclientcursor.h b/src/mongo/client/dbclientcursor.h
index c0367b830a0..e75bea59a15 100644
--- a/src/mongo/client/dbclientcursor.h
+++ b/src/mongo/client/dbclientcursor.h
@@ -267,6 +267,7 @@ private:
std::string _scopedHost;
std::string _lazyHost;
bool wasError;
+ BSONVersion _enabledBSONVersion;
void dataReceived() {
bool retry;