summaryrefslogtreecommitdiff
path: root/src/mongo/db/ops
diff options
context:
space:
mode:
authorAlya Berciu <alyacarina@gmail.com>2021-05-05 11:49:07 +0100
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-05-05 13:56:21 +0000
commit995f0406d72b1a15d18b2df2d8c0afa0c4c5b774 (patch)
treeeffaf0e332afd9d921a906cad369d921e2987d59 /src/mongo/db/ops
parent3f43af643ccbd4bd2135dd5999410c2c5578fe1a (diff)
downloadmongo-995f0406d72b1a15d18b2df2d8c0afa0c4c5b774.tar.gz
SERVER-49117 Remove storage validation of '$' prefixes in insert and update
Diffstat (limited to 'src/mongo/db/ops')
-rw-r--r--src/mongo/db/ops/insert.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mongo/db/ops/insert.cpp b/src/mongo/db/ops/insert.cpp
index e4a55cbea38..a4ba00b6cbc 100644
--- a/src/mongo/db/ops/insert.cpp
+++ b/src/mongo/db/ops/insert.cpp
@@ -35,6 +35,8 @@
#include "mongo/bson/bson_depth.h"
#include "mongo/db/catalog/document_validation.h"
#include "mongo/db/commands/feature_compatibility_version_parser.h"
+#include "mongo/db/query/dbref.h"
+#include "mongo/db/query/query_feature_flags_gen.h"
#include "mongo/db/repl/replication_coordinator.h"
#include "mongo/db/vector_clock_mutable.h"
#include "mongo/db/views/durable_view_catalog.h"
@@ -109,7 +111,8 @@ StatusWith<BSONObj> fixDocumentForInsert(OperationContext* opCtx, const BSONObj&
auto fieldName = e.fieldNameStringData();
- if (fieldName[0] == '$') {
+ if (!feature_flags::gFeatureFlagDotsAndDollars.isEnabledAndIgnoreFCV() &&
+ fieldName[0] == '$') {
return StatusWith<BSONObj>(
ErrorCodes::BadValue,
str::stream() << "Document can't have $ prefixed field names: " << fieldName);
@@ -129,7 +132,8 @@ StatusWith<BSONObj> fixDocumentForInsert(OperationContext* opCtx, const BSONObj&
if (e.type() == Array) {
return StatusWith<BSONObj>(ErrorCodes::BadValue, "can't use an array for _id");
}
- if (e.type() == Object) {
+ if (!feature_flags::gFeatureFlagDotsAndDollars.isEnabledAndIgnoreFCV() &&
+ e.type() == Object) {
BSONObj o = e.Obj();
Status s = o.storageValidEmbedded();
if (!s.isOK())