summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/db/instance.cpp8
-rw-r--r--src/mongo/db/namespace_string.h2
-rw-r--r--src/mongo/db/ops/update.cpp2
3 files changed, 6 insertions, 6 deletions
diff --git a/src/mongo/db/instance.cpp b/src/mongo/db/instance.cpp
index 2aa557d6357..8b78aa424ad 100644
--- a/src/mongo/db/instance.cpp
+++ b/src/mongo/db/instance.cpp
@@ -624,7 +624,7 @@ namespace mongo {
// the only question is whether this update is against the 'config' database, in
// which case we want to disable checks, since config db docs can have field names
// containing a dot (".").
- options.modOptions = ( NamespaceString( ns ).db() == "config" ) ?
+ options.modOptions = ( NamespaceString( ns ).isConfigDB() ) ?
ModifierInterface::Options::unchecked() :
ModifierInterface::Options::normal();
@@ -874,10 +874,10 @@ namespace mongo {
void checkAndInsert(const char *ns, /*modifies*/BSONObj& js) {
uassert( 10059 , "object to insert too large", js.objsize() <= BSONObjMaxUserSize);
- NamespaceString nsString(ns);
// Do not allow objects to be stored which violate okForStorageAsRoot
- if ( isNewUpdateFrameworkEnabled() && !nsString.isSystemCollOrConfigDB() ) {
- bool ok = js.okForStorageAsRoot();
+ if ( isNewUpdateFrameworkEnabled() ) {
+ NamespaceString nsString(ns);
+ bool ok = nsString.isConfigDB() || nsString.isSystem() || js.okForStorageAsRoot();
if (!ok) {
LOG(1) << "ns: " << ns << ", not okForStorageAsRoot: " << js;
}
diff --git a/src/mongo/db/namespace_string.h b/src/mongo/db/namespace_string.h
index ff768a2f847..56ecd38daac 100644
--- a/src/mongo/db/namespace_string.h
+++ b/src/mongo/db/namespace_string.h
@@ -50,7 +50,7 @@ namespace mongo {
size_t size() const { return _ns.size(); }
bool isSystem() const { return coll().startsWith( "system." ); }
- bool isSystemCollOrConfigDB() const { return db() == "config" || isSystem(); }
+ bool isConfigDB() const { return db() == "config"; }
bool isCommand() const { return coll() == "$cmd"; }
bool isSpecialCommand() const { return coll().startsWith("$cmd.sys"); }
diff --git a/src/mongo/db/ops/update.cpp b/src/mongo/db/ops/update.cpp
index b75d5599a7b..fe0d12b89cc 100644
--- a/src/mongo/db/ops/update.cpp
+++ b/src/mongo/db/ops/update.cpp
@@ -510,7 +510,7 @@ namespace mongo {
// Only user updates should be checked. Any system or replication stuff should pass through.
// Config db docs shouldn't get checked for valid field names since the shard key can have
// a dot (".") in it.
- bool shouldValidate = !(forReplication || nsStr.db() == "config");
+ bool shouldValidate = !(forReplication || nsStr.isConfigDB());
UpdateDriver::Options opts;
opts.multi = multi;