diff options
author | Tess Avitabile <tess.avitabile@mongodb.com> | 2016-09-02 18:09:55 -0400 |
---|---|---|
committer | Tess Avitabile <tess.avitabile@mongodb.com> | 2016-09-07 13:48:14 -0400 |
commit | ebb07d13b13beeefa589a9daf2db2b655b7e71ca (patch) | |
tree | 1c754c75be6e58a1ce0b1ef77c468484379c1c35 /src | |
parent | b5277068ff66e7fe2b2a98144aa6993ca6e17f5c (diff) | |
download | mongo-ebb07d13b13beeefa589a9daf2db2b655b7e71ca.tar.gz |
SERVER-25889 Collection validation should fail if featureCompatibilityVersion is 3.2 and the collection contains NumberDecimal values
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/catalog/collection.cpp | 8 | ||||
-rw-r--r-- | src/mongo/shell/utils.js | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/mongo/db/catalog/collection.cpp b/src/mongo/db/catalog/collection.cpp index b4651f41d5a..505f5703f75 100644 --- a/src/mongo/db/catalog/collection.cpp +++ b/src/mongo/db/catalog/collection.cpp @@ -68,6 +68,7 @@ #include "mongo/db/storage/wiredtiger/wiredtiger_record_store.h" #include "mongo/db/auth/user_document_parser.h" // XXX-ANDY +#include "mongo/rpc/object_check.h" #include "mongo/util/fail_point.h" #include "mongo/util/log.h" @@ -1057,11 +1058,8 @@ public: virtual Status validate(const RecordId& recordId, const RecordData& record, size_t* dataSize) { BSONObj recordBson = record.toBson(); - - // Use the latest BSON validation version. We do not say the collection is invalid for - // containing decimal data, even if decimal is disabled. - const Status status = - validateBSON(recordBson.objdata(), recordBson.objsize(), BSONVersion::kLatest); + const Status status = validateBSON( + recordBson.objdata(), recordBson.objsize(), Validator<BSONObj>::enabledBSONVersion()); if (status.isOK()) { *dataSize = recordBson.objsize(); } else { diff --git a/src/mongo/shell/utils.js b/src/mongo/shell/utils.js index cf2ed7ed8d3..d24e8aad3e9 100644 --- a/src/mongo/shell/utils.js +++ b/src/mongo/shell/utils.js @@ -197,7 +197,9 @@ jsTestOptions = function() { mongosBinVersion: TestData.mongosBinVersion || "", shardMixedBinVersions: TestData.shardMixedBinVersions || false, networkMessageCompressors: TestData.networkMessageCompressors, - skipValidationOnInvalidViewDefinitions: TestData.skipValidationOnInvalidViewDefinitions + skipValidationOnInvalidViewDefinitions: TestData.skipValidationOnInvalidViewDefinitions, + forceValidationWithFeatureCompatibilityVersion: + TestData.forceValidationWithFeatureCompatibilityVersion }); } return _jsTestOptions; |