summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorADAM David Alan Martin <adam.martin@10gen.com>2016-10-17 16:15:56 -0400
committerADAM David Alan Martin <adam.martin@10gen.com>2016-10-17 17:41:43 -0400
commitaffaff6131b836ae76cc987047b3c98e4eed2bf9 (patch)
treec670b897a4bbc1c9a993dd62527f1b60cf1ce34d /src
parent9f81fd5fa27b750cf3874f41ab92e9cf4c5fd36d (diff)
downloadmongo-affaff6131b836ae76cc987047b3c98e4eed2bf9.tar.gz
SERVER-26606: Add check of global flag for object verification.
The `dbclientcursor` should obey the `objcheck` flag, to avoid the penalty of BSON verification in performance-sensitive situations.
Diffstat (limited to 'src')
-rw-r--r--src/mongo/client/dbclientcursor.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/mongo/client/dbclientcursor.cpp b/src/mongo/client/dbclientcursor.cpp
index 325fa9c9fbd..da5bb661f71 100644
--- a/src/mongo/client/dbclientcursor.cpp
+++ b/src/mongo/client/dbclientcursor.cpp
@@ -347,11 +347,13 @@ 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,
- str::stream() << "Got invalid BSON from external server while reading from cursor"
- << causedBy(status),
- status.isOK());
+ if (serverGlobalParams.objcheck) {
+ auto status = validateBSON(batch.data, batch.remainingBytes, _enabledBSONVersion);
+ uassert(ErrorCodes::InvalidBSON,
+ str::stream() << "Got invalid BSON from external server while reading from cursor"
+ << causedBy(status),
+ status.isOK());
+ }
BSONObj o(batch.data);