summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands
diff options
context:
space:
mode:
authorclang-format-7.0.1 <adam.martin@10gen.com>2019-07-26 18:20:35 -0400
committerADAM David Alan Martin <adam.martin@10gen.com>2019-07-27 11:02:23 -0400
commit134a4083953270e8a11430395357fb70a29047ad (patch)
treedd428e1230e31d92b20b393dfdc17ffe7fa79cb6 /src/mongo/db/commands
parent1e46b5049003f427047e723ea5fab15b5a9253ca (diff)
downloadmongo-134a4083953270e8a11430395357fb70a29047ad.tar.gz
SERVER-41772 Apply clang-format 7.0.1 to the codebase
Diffstat (limited to 'src/mongo/db/commands')
-rw-r--r--src/mongo/db/commands/collection_to_capped.cpp3
-rw-r--r--src/mongo/db/commands/compact.cpp2
-rw-r--r--src/mongo/db/commands/connection_status.cpp2
-rw-r--r--src/mongo/db/commands/count_cmd.cpp2
-rw-r--r--src/mongo/db/commands/create_indexes.cpp33
-rw-r--r--src/mongo/db/commands/dbcheck.cpp4
-rw-r--r--src/mongo/db/commands/dbcommands.cpp4
-rw-r--r--src/mongo/db/commands/dbcommands_d.cpp8
-rw-r--r--src/mongo/db/commands/dbhash.cpp9
-rw-r--r--src/mongo/db/commands/driverHelpers.cpp2
-rw-r--r--src/mongo/db/commands/drop_indexes.cpp2
-rw-r--r--src/mongo/db/commands/explain_cmd.cpp3
-rw-r--r--src/mongo/db/commands/fail_point_cmd.cpp2
-rw-r--r--src/mongo/db/commands/feature_compatibility_version.cpp9
-rw-r--r--src/mongo/db/commands/feature_compatibility_version_command_parser.cpp20
-rw-r--r--src/mongo/db/commands/feature_compatibility_version_documentation.h4
-rw-r--r--src/mongo/db/commands/feature_compatibility_version_parser.cpp75
-rw-r--r--src/mongo/db/commands/find_cmd.cpp10
-rw-r--r--src/mongo/db/commands/fsync.cpp4
-rw-r--r--src/mongo/db/commands/fsync_locked.h10
-rw-r--r--src/mongo/db/commands/generic_servers.cpp4
-rw-r--r--src/mongo/db/commands/getmore_cmd.cpp22
-rw-r--r--src/mongo/db/commands/hashcmd.cpp2
-rw-r--r--src/mongo/db/commands/index_filter_commands.cpp2
-rw-r--r--src/mongo/db/commands/list_databases.cpp2
-rw-r--r--src/mongo/db/commands/list_indexes.cpp4
-rw-r--r--src/mongo/db/commands/lock_info.cpp2
-rw-r--r--src/mongo/db/commands/mr.cpp22
-rw-r--r--src/mongo/db/commands/mr.h16
-rw-r--r--src/mongo/db/commands/mr_common.cpp4
-rw-r--r--src/mongo/db/commands/mr_test.cpp6
-rw-r--r--src/mongo/db/commands/parameters.cpp17
-rw-r--r--src/mongo/db/commands/plan_cache_commands.cpp2
-rw-r--r--src/mongo/db/commands/plan_cache_commands_test.cpp25
-rw-r--r--src/mongo/db/commands/repair_cursor.cpp2
-rw-r--r--src/mongo/db/commands/run_aggregate.cpp4
-rw-r--r--src/mongo/db/commands/server_status_internal.cpp2
-rw-r--r--src/mongo/db/commands/server_status_internal.h2
-rw-r--r--src/mongo/db/commands/server_status_metric.cpp2
-rw-r--r--src/mongo/db/commands/server_status_metric.h2
-rw-r--r--src/mongo/db/commands/sleep_command.cpp2
-rw-r--r--src/mongo/db/commands/snapshot_management.cpp2
-rw-r--r--src/mongo/db/commands/test_commands.cpp2
-rw-r--r--src/mongo/db/commands/user_management_commands.cpp80
-rw-r--r--src/mongo/db/commands/user_management_commands_common.cpp35
-rw-r--r--src/mongo/db/commands/validate.cpp2
-rw-r--r--src/mongo/db/commands/write_commands/write_commands.cpp2
47 files changed, 195 insertions, 282 deletions
diff --git a/src/mongo/db/commands/collection_to_capped.cpp b/src/mongo/db/commands/collection_to_capped.cpp
index e2fab366906..42b1ff38dfe 100644
--- a/src/mongo/db/commands/collection_to_capped.cpp
+++ b/src/mongo/db/commands/collection_to_capped.cpp
@@ -118,8 +118,7 @@ public:
if (!repl::ReplicationCoordinator::get(opCtx)->canAcceptWritesFor(opCtx, nss)) {
uasserted(ErrorCodes::NotMaster,
str::stream() << "Not primary while cloning collection " << from << " to "
- << to
- << " (as capped)");
+ << to << " (as capped)");
}
Database* const db = autoDb.getDb();
diff --git a/src/mongo/db/commands/compact.cpp b/src/mongo/db/commands/compact.cpp
index 8ab36f3ac03..64e59324a71 100644
--- a/src/mongo/db/commands/compact.cpp
+++ b/src/mongo/db/commands/compact.cpp
@@ -115,4 +115,4 @@ public:
}
};
static CompactCmd compactCmd;
-}
+} // namespace mongo
diff --git a/src/mongo/db/commands/connection_status.cpp b/src/mongo/db/commands/connection_status.cpp
index cf470ebc6ae..04ca3a12f83 100644
--- a/src/mongo/db/commands/connection_status.cpp
+++ b/src/mongo/db/commands/connection_status.cpp
@@ -130,4 +130,4 @@ public:
return true;
}
} cmdConnectionStatus;
-}
+} // namespace mongo
diff --git a/src/mongo/db/commands/count_cmd.cpp b/src/mongo/db/commands/count_cmd.cpp
index 545afc0c174..4afc346ce0c 100644
--- a/src/mongo/db/commands/count_cmd.cpp
+++ b/src/mongo/db/commands/count_cmd.cpp
@@ -51,9 +51,9 @@
namespace mongo {
namespace {
-using std::unique_ptr;
using std::string;
using std::stringstream;
+using std::unique_ptr;
// Failpoint which causes to hang "count" cmd after acquiring the DB lock.
MONGO_FAIL_POINT_DEFINE(hangBeforeCollectionCount);
diff --git a/src/mongo/db/commands/create_indexes.cpp b/src/mongo/db/commands/create_indexes.cpp
index 8ca80adf742..9a5817e9983 100644
--- a/src/mongo/db/commands/create_indexes.cpp
+++ b/src/mongo/db/commands/create_indexes.cpp
@@ -111,9 +111,9 @@ StatusWith<std::vector<BSONObj>> parseAndValidateIndexSpecs(
if (kIndexesFieldName == cmdElemFieldName) {
if (cmdElem.type() != BSONType::Array) {
return {ErrorCodes::TypeMismatch,
- str::stream() << "The field '" << kIndexesFieldName
- << "' must be an array, but got "
- << typeName(cmdElem.type())};
+ str::stream()
+ << "The field '" << kIndexesFieldName << "' must be an array, but got "
+ << typeName(cmdElem.type())};
}
for (auto&& indexesElem : cmdElem.Obj()) {
@@ -166,16 +166,15 @@ StatusWith<std::vector<BSONObj>> parseAndValidateIndexSpecs(
continue;
} else {
return {ErrorCodes::BadValue,
- str::stream() << "Invalid field specified for " << kCommandName << " command: "
- << cmdElemFieldName};
+ str::stream() << "Invalid field specified for " << kCommandName
+ << " command: " << cmdElemFieldName};
}
}
if (!hasIndexesField) {
return {ErrorCodes::FailedToParse,
str::stream() << "The '" << kIndexesFieldName
- << "' field is a required argument of the "
- << kCommandName
+ << "' field is a required argument of the " << kCommandName
<< " command"};
}
@@ -205,15 +204,13 @@ Status validateTTLOptions(OperationContext* opCtx, const BSONObj& cmdObj) {
str::stream() << "TTL index '" << kExpireAfterSeconds
<< "' option must be numeric, but received a type of '"
<< typeName(expireAfterSecondsElt.type())
- << "'. Index spec: "
- << indexObj};
+ << "'. Index spec: " << indexObj};
}
if (expireAfterSecondsElt.safeNumberLong() < 0) {
return {ErrorCodes::CannotCreateIndex,
str::stream() << "TTL index '" << kExpireAfterSeconds
- << "' option cannot be less than 0. Index spec: "
- << indexObj};
+ << "' option cannot be less than 0. Index spec: " << indexObj};
}
const std::string tooLargeErr = str::stream()
@@ -296,8 +293,7 @@ void checkUniqueIndexConstraints(OperationContext* opCtx,
const ShardKeyPattern shardKeyPattern(metadata->getKeyPattern());
uassert(ErrorCodes::CannotCreateIndex,
str::stream() << "cannot create unique index over " << newIdxKey
- << " with shard key pattern "
- << shardKeyPattern.toBSON(),
+ << " with shard key pattern " << shardKeyPattern.toBSON(),
shardKeyPattern.isUniqueIndexCompatible(newIdxKey));
}
@@ -398,8 +394,7 @@ Collection* getOrCreateCollection(OperationContext* opCtx,
auto collection = db->createCollection(opCtx, ns, options);
invariant(collection,
str::stream() << "Failed to create collection " << ns.ns()
- << " during index creation: "
- << redact(cmdObj));
+ << " during index creation: " << redact(cmdObj));
wunit.commit();
return collection;
});
@@ -695,9 +690,7 @@ bool runCreateIndexesWithCoordinator(OperationContext* opCtx,
auto abortIndexFuture = indexBuildsCoord->abortIndexBuildByBuildUUID(
buildUUID,
str::stream() << "Index build interrupted due to change in replication state: "
- << buildUUID
- << ": "
- << ex.toString());
+ << buildUUID << ": " << ex.toString());
log() << "Index build aborted due to NotMaster error: " << buildUUID << ": "
<< abortIndexFuture.getNoThrow(opCtx);
throw;
@@ -717,9 +710,7 @@ bool runCreateIndexesWithCoordinator(OperationContext* opCtx,
// All other errors should be forwarded to the caller with index build information included.
log() << "Index build failed: " << buildUUID << ": " << ex.toStatus();
ex.addContext(str::stream() << "Index build failed: " << buildUUID << ": Collection " << ns
- << " ( "
- << *collectionUUID
- << " )");
+ << " ( " << *collectionUUID << " )");
// Set last op on error to provide the client with a specific optime to read the state of
// the server when the createIndexes command failed.
diff --git a/src/mongo/db/commands/dbcheck.cpp b/src/mongo/db/commands/dbcheck.cpp
index 484cac84eb9..7a3a5728bf7 100644
--- a/src/mongo/db/commands/dbcheck.cpp
+++ b/src/mongo/db/commands/dbcheck.cpp
@@ -339,7 +339,7 @@ private:
return false;
}
- auto[prev, next] = getPrevAndNextUUIDs(opCtx, collection);
+ auto [prev, next] = getPrevAndNextUUIDs(opCtx, collection);
// Find and report collection metadata.
auto indices = collectionIndexInfo(opCtx, collection);
@@ -546,4 +546,4 @@ public:
MONGO_REGISTER_TEST_COMMAND(DbCheckCmd);
} // namespace
-}
+} // namespace mongo
diff --git a/src/mongo/db/commands/dbcommands.cpp b/src/mongo/db/commands/dbcommands.cpp
index 291c5c36112..a08a951f5a4 100644
--- a/src/mongo/db/commands/dbcommands.cpp
+++ b/src/mongo/db/commands/dbcommands.cpp
@@ -143,8 +143,8 @@ public:
repl::ReplicationCoordinator::modeNone) &&
(dbname == NamespaceString::kLocalDb)) {
uasserted(ErrorCodes::IllegalOperation,
- str::stream() << "Cannot drop '" << dbname
- << "' database while replication is active");
+ str::stream()
+ << "Cannot drop '" << dbname << "' database while replication is active");
}
BSONElement e = cmdObj.firstElement();
int p = (int)e.number();
diff --git a/src/mongo/db/commands/dbcommands_d.cpp b/src/mongo/db/commands/dbcommands_d.cpp
index 68f07b43fd0..71642bec879 100644
--- a/src/mongo/db/commands/dbcommands_d.cpp
+++ b/src/mongo/db/commands/dbcommands_d.cpp
@@ -108,7 +108,7 @@ namespace {
/**
* Sets the profiling level, logging/profiling threshold, and logging/profiling sample rate for the
* given database.
-*/
+ */
class CmdProfile : public ProfileCmdBase {
public:
CmdProfile() = default;
@@ -205,8 +205,7 @@ public:
uassert(50847,
str::stream() << "The element that calls binDataClean() must be type of "
"BinData, but type of "
- << typeName(stateElem.type())
- << " found.",
+ << typeName(stateElem.type()) << " found.",
(stateElem.type() == BSONType::BinData));
int len;
@@ -293,8 +292,7 @@ public:
uassert(50849,
str::stream() << "The element that calls binDataClean() must be type "
"of BinData, but type of "
- << owned["data"].type()
- << " found.",
+ << owned["data"].type() << " found.",
owned["data"].type() == BSONType::BinData);
exec->saveState();
diff --git a/src/mongo/db/commands/dbhash.cpp b/src/mongo/db/commands/dbhash.cpp
index 5153192234d..72e4734d3e0 100644
--- a/src/mongo/db/commands/dbhash.cpp
+++ b/src/mongo/db/commands/dbhash.cpp
@@ -157,8 +157,7 @@ public:
str::stream() << "$_internalReadAtClusterTime value must not be greater"
" than the last applied opTime. Requested clusterTime: "
<< targetClusterTime.toString()
- << "; last applied opTime: "
- << lastAppliedOpTime.toString(),
+ << "; last applied opTime: " << lastAppliedOpTime.toString(),
lastAppliedOpTime.getTimestamp() >= targetClusterTime);
// We aren't holding the global lock in intent mode, so it is possible for the global
@@ -173,8 +172,7 @@ public:
str::stream() << "$_internalReadAtClusterTime value must not be greater"
" than the all_durable timestamp. Requested clusterTime: "
<< targetClusterTime.toString()
- << "; all_durable timestamp: "
- << allDurableTime.toString(),
+ << "; all_durable timestamp: " << allDurableTime.toString(),
allDurableTime >= targetClusterTime);
// The $_internalReadAtClusterTime option causes any storage-layer cursors created
@@ -334,8 +332,7 @@ private:
str::stream() << "Unable to read from a snapshot due to pending collection"
" catalog changes; please retry the operation. Snapshot"
" timestamp is "
- << mySnapshot->toString()
- << ". Collection minimum timestamp is "
+ << mySnapshot->toString() << ". Collection minimum timestamp is "
<< minSnapshot->toString(),
!minSnapshot || *mySnapshot >= *minSnapshot);
} else {
diff --git a/src/mongo/db/commands/driverHelpers.cpp b/src/mongo/db/commands/driverHelpers.cpp
index 58f73648b4e..3a3ca1b8704 100644
--- a/src/mongo/db/commands/driverHelpers.cpp
+++ b/src/mongo/db/commands/driverHelpers.cpp
@@ -87,4 +87,4 @@ public:
return true;
}
} driverObjectIdTest;
-}
+} // namespace mongo
diff --git a/src/mongo/db/commands/drop_indexes.cpp b/src/mongo/db/commands/drop_indexes.cpp
index 25702078378..7a6b530af8f 100644
--- a/src/mongo/db/commands/drop_indexes.cpp
+++ b/src/mongo/db/commands/drop_indexes.cpp
@@ -243,4 +243,4 @@ public:
return true;
}
} cmdReIndex;
-}
+} // namespace mongo
diff --git a/src/mongo/db/commands/explain_cmd.cpp b/src/mongo/db/commands/explain_cmd.cpp
index 5f6f034f4d2..277fb80b3c7 100644
--- a/src/mongo/db/commands/explain_cmd.cpp
+++ b/src/mongo/db/commands/explain_cmd.cpp
@@ -153,8 +153,7 @@ std::unique_ptr<CommandInvocation> CmdExplain::parse(OperationContext* opCtx,
if (auto innerDb = explainedObj["$db"]) {
uassert(ErrorCodes::InvalidNamespace,
str::stream() << "Mismatched $db in explain command. Expected " << dbname
- << " but got "
- << innerDb.checkAndGetStringData(),
+ << " but got " << innerDb.checkAndGetStringData(),
innerDb.checkAndGetStringData() == dbname);
}
auto explainedCommand = CommandHelpers::findCommand(explainedObj.firstElementFieldName());
diff --git a/src/mongo/db/commands/fail_point_cmd.cpp b/src/mongo/db/commands/fail_point_cmd.cpp
index 52ffb278a22..a50cc4ff06d 100644
--- a/src/mongo/db/commands/fail_point_cmd.cpp
+++ b/src/mongo/db/commands/fail_point_cmd.cpp
@@ -103,4 +103,4 @@ public:
}
};
MONGO_REGISTER_TEST_COMMAND(FaultInjectCmd);
-}
+} // namespace mongo
diff --git a/src/mongo/db/commands/feature_compatibility_version.cpp b/src/mongo/db/commands/feature_compatibility_version.cpp
index cab903e15d3..ec1d65deb3b 100644
--- a/src/mongo/db/commands/feature_compatibility_version.cpp
+++ b/src/mongo/db/commands/feature_compatibility_version.cpp
@@ -215,12 +215,9 @@ void FeatureCompatibilityVersion::updateMinWireVersion() {
void FeatureCompatibilityVersion::_validateVersion(StringData version) {
uassert(40284,
str::stream() << "featureCompatibilityVersion must be '"
- << FeatureCompatibilityVersionParser::kVersion42
- << "' or '"
- << FeatureCompatibilityVersionParser::kVersion40
- << "'. See "
- << feature_compatibility_version_documentation::kCompatibilityLink
- << ".",
+ << FeatureCompatibilityVersionParser::kVersion42 << "' or '"
+ << FeatureCompatibilityVersionParser::kVersion40 << "'. See "
+ << feature_compatibility_version_documentation::kCompatibilityLink << ".",
version == FeatureCompatibilityVersionParser::kVersion42 ||
version == FeatureCompatibilityVersionParser::kVersion40);
}
diff --git a/src/mongo/db/commands/feature_compatibility_version_command_parser.cpp b/src/mongo/db/commands/feature_compatibility_version_command_parser.cpp
index 6d68b8f417b..919a2aae34c 100644
--- a/src/mongo/db/commands/feature_compatibility_version_command_parser.cpp
+++ b/src/mongo/db/commands/feature_compatibility_version_command_parser.cpp
@@ -56,10 +56,7 @@ StatusWith<std::string> FeatureCompatibilityVersionCommandParser::extractVersion
return {ErrorCodes::TypeMismatch,
str::stream() << "Command argument must be of type "
"String, but was of type "
- << typeName(versionElem.type())
- << " in: "
- << cmdObj
- << ". See "
+ << typeName(versionElem.type()) << " in: " << cmdObj << ". See "
<< feature_compatibility_version_documentation::kCompatibilityLink
<< "."};
}
@@ -73,9 +70,7 @@ StatusWith<std::string> FeatureCompatibilityVersionCommandParser::extractVersion
uasserted(ErrorCodes::InvalidOptions,
str::stream() << "Unrecognized field found " << cmdElem.fieldNameStringData()
- << " in "
- << cmdObj
- << ". See "
+ << " in " << cmdObj << ". See "
<< feature_compatibility_version_documentation::kCompatibilityLink
<< ".");
}
@@ -86,14 +81,9 @@ StatusWith<std::string> FeatureCompatibilityVersionCommandParser::extractVersion
version != FeatureCompatibilityVersionParser::kVersion40) {
return {ErrorCodes::BadValue,
str::stream() << "Invalid command argument. Expected '"
- << FeatureCompatibilityVersionParser::kVersion42
- << "' or '"
- << FeatureCompatibilityVersionParser::kVersion40
- << "', found "
- << version
- << " in: "
- << cmdObj
- << ". See "
+ << FeatureCompatibilityVersionParser::kVersion42 << "' or '"
+ << FeatureCompatibilityVersionParser::kVersion40 << "', found "
+ << version << " in: " << cmdObj << ". See "
<< feature_compatibility_version_documentation::kCompatibilityLink
<< "."};
}
diff --git a/src/mongo/db/commands/feature_compatibility_version_documentation.h b/src/mongo/db/commands/feature_compatibility_version_documentation.h
index 7b51814b2ac..0be6c0b1f39 100644
--- a/src/mongo/db/commands/feature_compatibility_version_documentation.h
+++ b/src/mongo/db/commands/feature_compatibility_version_documentation.h
@@ -34,5 +34,5 @@ namespace feature_compatibility_version_documentation {
constexpr StringData kCompatibilityLink =
"http://dochub.mongodb.org/core/4.0-feature-compatibility"_sd;
constexpr StringData kUpgradeLink = "http://dochub.mongodb.org/core/4.0-upgrade-fcv"_sd;
-}
-}
+} // namespace feature_compatibility_version_documentation
+} // namespace mongo
diff --git a/src/mongo/db/commands/feature_compatibility_version_parser.cpp b/src/mongo/db/commands/feature_compatibility_version_parser.cpp
index 4a86d174468..0aa872b9041 100644
--- a/src/mongo/db/commands/feature_compatibility_version_parser.cpp
+++ b/src/mongo/db/commands/feature_compatibility_version_parser.cpp
@@ -61,37 +61,26 @@ FeatureCompatibilityVersionParser::parse(const BSONObj& featureCompatibilityVers
continue;
} else if (fieldName == kVersionField || fieldName == kTargetVersionField) {
if (elem.type() != BSONType::String) {
- return Status(
- ErrorCodes::TypeMismatch,
- str::stream() << fieldName << " must be of type String, but was of type "
- << typeName(elem.type())
- << ". Contents of "
- << kParameterName
+ return Status(ErrorCodes::TypeMismatch,
+ str::stream()
+ << fieldName << " must be of type String, but was of type "
+ << typeName(elem.type()) << ". Contents of " << kParameterName
<< " document in "
<< NamespaceString::kServerConfigurationNamespace.toString()
- << ": "
- << featureCompatibilityVersionDoc
- << ". See "
+ << ": " << featureCompatibilityVersionDoc << ". See "
<< feature_compatibility_version_documentation::kCompatibilityLink
<< ".");
}
if (elem.String() != kVersion42 && elem.String() != kVersion40) {
- return Status(
- ErrorCodes::BadValue,
- str::stream() << "Invalid value for " << fieldName << ", found "
- << elem.String()
- << ", expected '"
- << kVersion42
- << "' or '"
- << kVersion40
- << "'. Contents of "
- << kParameterName
+ return Status(ErrorCodes::BadValue,
+ str::stream()
+ << "Invalid value for " << fieldName << ", found "
+ << elem.String() << ", expected '" << kVersion42 << "' or '"
+ << kVersion40 << "'. Contents of " << kParameterName
<< " document in "
<< NamespaceString::kServerConfigurationNamespace.toString()
- << ": "
- << featureCompatibilityVersionDoc
- << ". See "
+ << ": " << featureCompatibilityVersionDoc << ". See "
<< feature_compatibility_version_documentation::kCompatibilityLink
<< ".");
}
@@ -102,15 +91,12 @@ FeatureCompatibilityVersionParser::parse(const BSONObj& featureCompatibilityVers
targetVersionString = elem.String();
}
} else {
- return Status(
- ErrorCodes::BadValue,
- str::stream() << "Unrecognized field '" << fieldName << "'. Contents of "
- << kParameterName
- << " document in "
- << NamespaceString::kServerConfigurationNamespace.toString()
- << ": "
- << featureCompatibilityVersionDoc
- << ". See "
+ return Status(ErrorCodes::BadValue,
+ str::stream()
+ << "Unrecognized field '" << fieldName << "'. Contents of "
+ << kParameterName << " document in "
+ << NamespaceString::kServerConfigurationNamespace.toString() << ": "
+ << featureCompatibilityVersionDoc << ". See "
<< feature_compatibility_version_documentation::kCompatibilityLink
<< ".");
}
@@ -126,28 +112,23 @@ FeatureCompatibilityVersionParser::parse(const BSONObj& featureCompatibilityVers
}
} else if (versionString == kVersion42) {
if (targetVersionString == kVersion42 || targetVersionString == kVersion40) {
- return Status(
- ErrorCodes::BadValue,
- str::stream() << "Invalid state for " << kParameterName << " document in "
- << NamespaceString::kServerConfigurationNamespace.toString()
- << ": "
- << featureCompatibilityVersionDoc
- << ". See "
+ return Status(ErrorCodes::BadValue,
+ str::stream()
+ << "Invalid state for " << kParameterName << " document in "
+ << NamespaceString::kServerConfigurationNamespace.toString() << ": "
+ << featureCompatibilityVersionDoc << ". See "
<< feature_compatibility_version_documentation::kCompatibilityLink
<< ".");
} else {
version = ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo42;
}
} else {
- return Status(
- ErrorCodes::BadValue,
- str::stream() << "Missing required field '" << kVersionField << "''. Contents of "
- << kParameterName
- << " document in "
- << NamespaceString::kServerConfigurationNamespace.toString()
- << ": "
- << featureCompatibilityVersionDoc
- << ". See "
+ return Status(ErrorCodes::BadValue,
+ str::stream()
+ << "Missing required field '" << kVersionField << "''. Contents of "
+ << kParameterName << " document in "
+ << NamespaceString::kServerConfigurationNamespace.toString() << ": "
+ << featureCompatibilityVersionDoc << ". See "
<< feature_compatibility_version_documentation::kCompatibilityLink
<< ".");
}
diff --git a/src/mongo/db/commands/find_cmd.cpp b/src/mongo/db/commands/find_cmd.cpp
index 52250811dbd..88705768bcc 100644
--- a/src/mongo/db/commands/find_cmd.cpp
+++ b/src/mongo/db/commands/find_cmd.cpp
@@ -216,8 +216,8 @@ public:
} catch (DBException& error) {
if (error.code() == ErrorCodes::InvalidPipelineOperator) {
uasserted(ErrorCodes::InvalidPipelineOperator,
- str::stream() << "Unsupported in view pipeline: "
- << error.what());
+ str::stream()
+ << "Unsupported in view pipeline: " << error.what());
}
throw;
}
@@ -329,8 +329,7 @@ public:
str::stream() << "$_internalReadAtClusterTime value must not be greater"
" than the last applied opTime. Requested clusterTime: "
<< targetClusterTime->toString()
- << "; last applied opTime: "
- << lastAppliedOpTime.toString(),
+ << "; last applied opTime: " << lastAppliedOpTime.toString(),
lastAppliedOpTime.getTimestamp() >= targetClusterTime);
// We aren't holding the global lock in intent mode, so it is possible for the
@@ -346,8 +345,7 @@ public:
" than the all_durable timestamp. Requested"
" clusterTime: "
<< targetClusterTime->toString()
- << "; all_durable timestamp: "
- << allDurableTime.toString(),
+ << "; all_durable timestamp: " << allDurableTime.toString(),
allDurableTime >= targetClusterTime);
// The $_internalReadAtClusterTime option causes any storage-layer cursors created
diff --git a/src/mongo/db/commands/fsync.cpp b/src/mongo/db/commands/fsync.cpp
index 7bb1aa48ae5..3f3f2cc9374 100644
--- a/src/mongo/db/commands/fsync.cpp
+++ b/src/mongo/db/commands/fsync.cpp
@@ -64,7 +64,7 @@ namespace {
// Ensures that only one command is operating on fsyncLock state at a time. As a 'ResourceMutex',
// lock time will be reported for a given user operation.
Lock::ResourceMutex commandMutex("fsyncCommandMutex");
-}
+} // namespace
/**
* Maintains a global read lock while mongod is fsyncLocked.
@@ -437,4 +437,4 @@ MONGO_INITIALIZER(fsyncLockedForWriting)(InitializerContext* context) {
setLockedForWritingImpl([]() { return fsyncCmd.fsyncLocked(); });
return Status::OK();
}
-}
+} // namespace mongo
diff --git a/src/mongo/db/commands/fsync_locked.h b/src/mongo/db/commands/fsync_locked.h
index b5d4ccffd09..89e8f8c55ba 100644
--- a/src/mongo/db/commands/fsync_locked.h
+++ b/src/mongo/db/commands/fsync_locked.h
@@ -33,14 +33,14 @@
namespace mongo {
/**
-* Returns true if mongod is currently fsyncLocked.
-*/
+ * Returns true if mongod is currently fsyncLocked.
+ */
bool lockedForWriting();
/**
-* Sets the implementation for lockedForWriting(). Should be done once during startup in a
-* MONGO_INITIALIZER.
-*/
+ * Sets the implementation for lockedForWriting(). Should be done once during startup in a
+ * MONGO_INITIALIZER.
+ */
void setLockedForWritingImpl(std::function<bool()> impl);
} // namespace mongo
diff --git a/src/mongo/db/commands/generic_servers.cpp b/src/mongo/db/commands/generic_servers.cpp
index 6106c465537..9c0a0ad661f 100644
--- a/src/mongo/db/commands/generic_servers.cpp
+++ b/src/mongo/db/commands/generic_servers.cpp
@@ -240,9 +240,7 @@ public:
if (val.type() != String) {
uasserted(ErrorCodes::TypeMismatch,
str::stream() << "Argument to getLog must be of type String; found "
- << val.toString(false)
- << " of type "
- << typeName(val.type()));
+ << val.toString(false) << " of type " << typeName(val.type()));
}
string p = val.String();
diff --git a/src/mongo/db/commands/getmore_cmd.cpp b/src/mongo/db/commands/getmore_cmd.cpp
index 9920db02e75..6f91ec1fca7 100644
--- a/src/mongo/db/commands/getmore_cmd.cpp
+++ b/src/mongo/db/commands/getmore_cmd.cpp
@@ -86,17 +86,14 @@ void validateLSID(OperationContext* opCtx, const GetMoreRequest& request, Client
uassert(50737,
str::stream() << "Cannot run getMore on cursor " << request.cursorid
- << ", which was created in session "
- << *cursor->getSessionId()
+ << ", which was created in session " << *cursor->getSessionId()
<< ", without an lsid",
opCtx->getLogicalSessionId() || !cursor->getSessionId());
uassert(50738,
str::stream() << "Cannot run getMore on cursor " << request.cursorid
- << ", which was created in session "
- << *cursor->getSessionId()
- << ", in session "
- << *opCtx->getLogicalSessionId(),
+ << ", which was created in session " << *cursor->getSessionId()
+ << ", in session " << *opCtx->getLogicalSessionId(),
!opCtx->getLogicalSessionId() || !cursor->getSessionId() ||
(opCtx->getLogicalSessionId() == cursor->getSessionId()));
}
@@ -116,17 +113,14 @@ void validateTxnNumber(OperationContext* opCtx,
uassert(50740,
str::stream() << "Cannot run getMore on cursor " << request.cursorid
- << ", which was created in transaction "
- << *cursor->getTxnNumber()
+ << ", which was created in transaction " << *cursor->getTxnNumber()
<< ", without a txnNumber",
opCtx->getTxnNumber() || !cursor->getTxnNumber());
uassert(50741,
str::stream() << "Cannot run getMore on cursor " << request.cursorid
- << ", which was created in transaction "
- << *cursor->getTxnNumber()
- << ", in transaction "
- << *opCtx->getTxnNumber(),
+ << ", which was created in transaction " << *cursor->getTxnNumber()
+ << ", in transaction " << *opCtx->getTxnNumber(),
!opCtx->getTxnNumber() || !cursor->getTxnNumber() ||
(*opCtx->getTxnNumber() == *cursor->getTxnNumber()));
}
@@ -434,8 +428,8 @@ public:
// Ensure that the client still has the privileges to run the originating command.
if (!authzSession->isAuthorizedForPrivileges(cursorPin->getOriginatingPrivileges())) {
uasserted(ErrorCodes::Unauthorized,
- str::stream() << "not authorized for getMore with cursor id "
- << _request.cursorid);
+ str::stream()
+ << "not authorized for getMore with cursor id " << _request.cursorid);
}
if (_request.nss != cursorPin->nss()) {
diff --git a/src/mongo/db/commands/hashcmd.cpp b/src/mongo/db/commands/hashcmd.cpp
index 2d69dcb6e9f..04b3c7f87ed 100644
--- a/src/mongo/db/commands/hashcmd.cpp
+++ b/src/mongo/db/commands/hashcmd.cpp
@@ -101,4 +101,4 @@ public:
}
};
MONGO_REGISTER_TEST_COMMAND(CmdHashElt);
-}
+} // namespace mongo
diff --git a/src/mongo/db/commands/index_filter_commands.cpp b/src/mongo/db/commands/index_filter_commands.cpp
index b5c65b1e2be..48901a6ae58 100644
--- a/src/mongo/db/commands/index_filter_commands.cpp
+++ b/src/mongo/db/commands/index_filter_commands.cpp
@@ -110,8 +110,8 @@ namespace mongo {
using std::string;
using std::stringstream;
-using std::vector;
using std::unique_ptr;
+using std::vector;
IndexFilterCommand::IndexFilterCommand(const string& name, const string& helpText)
: BasicCommand(name), helpText(helpText) {}
diff --git a/src/mongo/db/commands/list_databases.cpp b/src/mongo/db/commands/list_databases.cpp
index 52f4c49f2f2..2c34bb715c7 100644
--- a/src/mongo/db/commands/list_databases.cpp
+++ b/src/mongo/db/commands/list_databases.cpp
@@ -188,4 +188,4 @@ public:
return true;
}
} cmdListDatabases;
-}
+} // namespace mongo
diff --git a/src/mongo/db/commands/list_indexes.cpp b/src/mongo/db/commands/list_indexes.cpp
index aa64d182e01..d17b924223f 100644
--- a/src/mongo/db/commands/list_indexes.cpp
+++ b/src/mongo/db/commands/list_indexes.cpp
@@ -127,8 +127,8 @@ public:
}
return Status(ErrorCodes::Unauthorized,
- str::stream() << "Not authorized to list indexes on collection: "
- << nss.ns());
+ str::stream()
+ << "Not authorized to list indexes on collection: " << nss.ns());
}
bool run(OperationContext* opCtx,
diff --git a/src/mongo/db/commands/lock_info.cpp b/src/mongo/db/commands/lock_info.cpp
index da2538006dd..cb820b02fe8 100644
--- a/src/mongo/db/commands/lock_info.cpp
+++ b/src/mongo/db/commands/lock_info.cpp
@@ -105,4 +105,4 @@ public:
return true;
}
} cmdLockInfo;
-}
+} // namespace mongo
diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp
index 7d0d52be379..0deaf4d262f 100644
--- a/src/mongo/db/commands/mr.cpp
+++ b/src/mongo/db/commands/mr.cpp
@@ -656,9 +656,7 @@ void State::appendResults(BSONObjBuilder& final) {
BSONObj idKey = BSON("_id" << 1);
if (!_db.runCommand("admin",
BSON("splitVector" << _config.outputOptions.finalNamespace.ns()
- << "keyPattern"
- << idKey
- << "maxChunkSizeBytes"
+ << "keyPattern" << idKey << "maxChunkSizeBytes"
<< _config.splitInfo),
res)) {
uasserted(15921, str::stream() << "splitVector failed: " << res);
@@ -746,8 +744,7 @@ long long State::postProcessCollectionNonAtomic(OperationContext* opCtx,
if (!_db.runCommand("admin",
BSON("renameCollection" << _config.tempNamespace.ns() << "to"
<< _config.outputOptions.finalNamespace.ns()
- << "stayTemp"
- << _config.shardedFirstPass),
+ << "stayTemp" << _config.shardedFirstPass),
info)) {
uasserted(10076, str::stream() << "rename failed: " << info);
}
@@ -831,9 +828,7 @@ void State::insert(const NamespaceString& nss, const BSONObj& o) {
uassert(
ErrorCodes::PrimarySteppedDown,
str::stream() << "no longer primary while inserting mapReduce result into collection: "
- << nss
- << ": "
- << redact(o),
+ << nss << ": " << redact(o),
repl::ReplicationCoordinator::get(_opCtx)->canAcceptWritesFor(_opCtx, nss));
assertCollectionNotNull(nss, autoColl);
@@ -880,10 +875,8 @@ void State::_insertToInc(BSONObj& o) {
if (o.objsize() > BSONObjMaxUserSize) {
uasserted(ErrorCodes::BadValue,
str::stream() << "object to insert too large for incremental collection"
- << ". size in bytes: "
- << o.objsize()
- << ", max size: "
- << BSONObjMaxUserSize);
+ << ". size in bytes: " << o.objsize()
+ << ", max size: " << BSONObjMaxUserSize);
}
// TODO: Consider whether to pass OpDebug for stats tracking under SERVER-23261.
@@ -932,8 +925,9 @@ State::~State() {
_useIncremental ? _config.incLong : NamespaceString());
} catch (...) {
error() << "Unable to drop temporary collection created by mapReduce: "
- << _config.tempNamespace << ". This collection will be removed automatically "
- "the next time the server starts up. "
+ << _config.tempNamespace
+ << ". This collection will be removed automatically "
+ "the next time the server starts up. "
<< exceptionToStatus();
}
}
diff --git a/src/mongo/db/commands/mr.h b/src/mongo/db/commands/mr.h
index 5bc5d23a227..d5e32d1f9b5 100644
--- a/src/mongo/db/commands/mr.h
+++ b/src/mongo/db/commands/mr.h
@@ -159,7 +159,7 @@ private:
* result in "__returnValue"
* @param key OUT
* @param endSizeEstimate OUT
- */
+ */
void _reduce(const BSONList& values, BSONObj& key, int& endSizeEstimate);
JSFunction _func;
@@ -267,13 +267,13 @@ public:
void emit(const BSONObj& a);
/**
- * Checks the size of the transient in-memory results accumulated so far and potentially
- * runs reduce in order to compact them. If the data is still too large, it will be
- * spilled to the output collection.
- *
- * NOTE: Make sure that no DB locks are held, when calling this function, because it may
- * try to acquire write DB lock for the write to the output collection.
- */
+ * Checks the size of the transient in-memory results accumulated so far and potentially
+ * runs reduce in order to compact them. If the data is still too large, it will be
+ * spilled to the output collection.
+ *
+ * NOTE: Make sure that no DB locks are held, when calling this function, because it may
+ * try to acquire write DB lock for the write to the output collection.
+ */
void reduceAndSpillInMemoryStateIfNeeded();
/**
diff --git a/src/mongo/db/commands/mr_common.cpp b/src/mongo/db/commands/mr_common.cpp
index 90ebddcd6e6..4b5d2006054 100644
--- a/src/mongo/db/commands/mr_common.cpp
+++ b/src/mongo/db/commands/mr_common.cpp
@@ -156,5 +156,5 @@ bool mrSupportsWriteConcern(const BSONObj& cmd) {
return true;
}
}
-}
-}
+} // namespace mr
+} // namespace mongo
diff --git a/src/mongo/db/commands/mr_test.cpp b/src/mongo/db/commands/mr_test.cpp
index 53735cdc5ea..53b06339448 100644
--- a/src/mongo/db/commands/mr_test.cpp
+++ b/src/mongo/db/commands/mr_test.cpp
@@ -74,11 +74,7 @@ void _compareOutputOptionField(const std::string& dbname,
if (actual == expected)
return;
FAIL(str::stream() << "parseOutputOptions(\"" << dbname << ", " << cmdObjStr << "): "
- << fieldName
- << ": Expected: "
- << expected
- << ". Actual: "
- << actual);
+ << fieldName << ": Expected: " << expected << ". Actual: " << actual);
}
/**
diff --git a/src/mongo/db/commands/parameters.cpp b/src/mongo/db/commands/parameters.cpp
index 09e7f52f688..4f2306ad1b2 100644
--- a/src/mongo/db/commands/parameters.cpp
+++ b/src/mongo/db/commands/parameters.cpp
@@ -306,8 +306,8 @@ public:
// Make sure we are allowed to change this parameter
if (!foundParameter->second->allowedToChangeAtRuntime()) {
- errmsg = str::stream() << "not allowed to change [" << parameterName
- << "] at runtime";
+ errmsg = str::stream()
+ << "not allowed to change [" << parameterName << "] at runtime";
return false;
}
@@ -365,9 +365,8 @@ public:
log() << "successfully set parameter " << parameterName << " to "
<< redact(parameter.toString(false))
- << (oldValue ? std::string(str::stream() << " (was "
- << redact(oldValue.toString(false))
- << ")")
+ << (oldValue ? std::string(str::stream()
+ << " (was " << redact(oldValue.toString(false)) << ")")
: "");
numSet++;
@@ -422,8 +421,8 @@ void LogComponentVerbosityServerParameter::append(OperationContext*,
Status LogComponentVerbosityServerParameter::set(const BSONElement& newValueElement) {
if (!newValueElement.isABSONObj()) {
return Status(ErrorCodes::TypeMismatch,
- str::stream() << "log component verbosity is not a BSON object: "
- << newValueElement);
+ str::stream()
+ << "log component verbosity is not a BSON object: " << newValueElement);
}
return setLogComponentVerbosity(newValueElement.Obj());
}
@@ -456,9 +455,7 @@ Status AutomationServiceDescriptorServerParameter::setFromString(const std::stri
if (str.size() > kMaxSize)
return {ErrorCodes::Overflow,
str::stream() << "Value for parameter automationServiceDescriptor"
- << " must be no more than "
- << kMaxSize
- << " bytes"};
+ << " must be no more than " << kMaxSize << " bytes"};
{
const stdx::lock_guard<stdx::mutex> lock(autoServiceDescriptorMutex);
diff --git a/src/mongo/db/commands/plan_cache_commands.cpp b/src/mongo/db/commands/plan_cache_commands.cpp
index 4fc13e65c6a..6f821a7c50a 100644
--- a/src/mongo/db/commands/plan_cache_commands.cpp
+++ b/src/mongo/db/commands/plan_cache_commands.cpp
@@ -104,8 +104,8 @@ namespace mongo {
using std::string;
using std::stringstream;
-using std::vector;
using std::unique_ptr;
+using std::vector;
PlanCacheCommand::PlanCacheCommand(const string& name,
const string& helpText,
diff --git a/src/mongo/db/commands/plan_cache_commands_test.cpp b/src/mongo/db/commands/plan_cache_commands_test.cpp
index 0d35b3ada49..291bc64eb9b 100644
--- a/src/mongo/db/commands/plan_cache_commands_test.cpp
+++ b/src/mongo/db/commands/plan_cache_commands_test.cpp
@@ -341,12 +341,12 @@ TEST(PlanCacheCommandsTest, planCacheClearOneKey) {
// Check keys in cache before dropping {b: 1}
vector<BSONObj> shapesBefore = getShapes(planCache);
ASSERT_EQUALS(shapesBefore.size(), 2U);
- BSONObj shapeA = BSON(
- "query" << cqA->getQueryObj() << "sort" << cqA->getQueryRequest().getSort() << "projection"
- << cqA->getQueryRequest().getProj());
- BSONObj shapeB = BSON(
- "query" << cqB->getQueryObj() << "sort" << cqB->getQueryRequest().getSort() << "projection"
- << cqB->getQueryRequest().getProj());
+ BSONObj shapeA =
+ BSON("query" << cqA->getQueryObj() << "sort" << cqA->getQueryRequest().getSort()
+ << "projection" << cqA->getQueryRequest().getProj());
+ BSONObj shapeB =
+ BSON("query" << cqB->getQueryObj() << "sort" << cqB->getQueryRequest().getSort()
+ << "projection" << cqB->getQueryRequest().getProj());
ASSERT_TRUE(
std::find_if(shapesBefore.begin(), shapesBefore.end(), [&shapeA](const BSONObj& obj) {
auto filteredObj = obj.removeField("queryHash");
@@ -413,14 +413,11 @@ TEST(PlanCacheCommandsTest, planCacheClearOneKeyCollation) {
vector<BSONObj> shapesBefore = getShapes(planCache);
ASSERT_EQUALS(shapesBefore.size(), 2U);
BSONObj shape = BSON("query" << cq->getQueryObj() << "sort" << cq->getQueryRequest().getSort()
- << "projection"
- << cq->getQueryRequest().getProj());
- BSONObj shapeWithCollation = BSON("query" << cqCollation->getQueryObj() << "sort"
- << cqCollation->getQueryRequest().getSort()
- << "projection"
- << cqCollation->getQueryRequest().getProj()
- << "collation"
- << cqCollation->getCollator()->getSpec().toBSON());
+ << "projection" << cq->getQueryRequest().getProj());
+ BSONObj shapeWithCollation = BSON(
+ "query" << cqCollation->getQueryObj() << "sort" << cqCollation->getQueryRequest().getSort()
+ << "projection" << cqCollation->getQueryRequest().getProj() << "collation"
+ << cqCollation->getCollator()->getSpec().toBSON());
ASSERT_TRUE(
std::find_if(shapesBefore.begin(), shapesBefore.end(), [&shape](const BSONObj& obj) {
auto filteredObj = obj.removeField("queryHash");
diff --git a/src/mongo/db/commands/repair_cursor.cpp b/src/mongo/db/commands/repair_cursor.cpp
index 9618543a0a9..3fd5a94da1c 100644
--- a/src/mongo/db/commands/repair_cursor.cpp
+++ b/src/mongo/db/commands/repair_cursor.cpp
@@ -115,4 +115,4 @@ public:
return true;
}
} repairCursorCmd;
-}
+} // namespace mongo
diff --git a/src/mongo/db/commands/run_aggregate.cpp b/src/mongo/db/commands/run_aggregate.cpp
index 7293a0b01cb..3287294783c 100644
--- a/src/mongo/db/commands/run_aggregate.cpp
+++ b/src/mongo/db/commands/run_aggregate.cpp
@@ -299,8 +299,8 @@ StatusWith<StringMap<ExpressionContext::ResolvedNamespace>> resolveInvolvedNames
auto resolvedView = viewCatalog->resolveView(opCtx, involvedNs);
if (!resolvedView.isOK()) {
return {ErrorCodes::FailedToParse,
- str::stream() << "Failed to resolve view '" << involvedNs.ns() << "': "
- << resolvedView.getStatus().toString()};
+ str::stream() << "Failed to resolve view '" << involvedNs.ns()
+ << "': " << resolvedView.getStatus().toString()};
}
resolvedNamespaces[involvedNs.coll()] = {resolvedView.getValue().getNamespace(),
diff --git a/src/mongo/db/commands/server_status_internal.cpp b/src/mongo/db/commands/server_status_internal.cpp
index 7556eee5e01..c981a65fd4b 100644
--- a/src/mongo/db/commands/server_status_internal.cpp
+++ b/src/mongo/db/commands/server_status_internal.cpp
@@ -83,4 +83,4 @@ void MetricTree::appendTo(BSONObjBuilder& b) const {
bb.done();
}
}
-}
+} // namespace mongo
diff --git a/src/mongo/db/commands/server_status_internal.h b/src/mongo/db/commands/server_status_internal.h
index cbd67fa0056..f9bde775db3 100644
--- a/src/mongo/db/commands/server_status_internal.h
+++ b/src/mongo/db/commands/server_status_internal.h
@@ -52,4 +52,4 @@ private:
std::map<std::string, MetricTree*> _subtrees;
std::map<std::string, ServerStatusMetric*> _metrics;
};
-}
+} // namespace mongo
diff --git a/src/mongo/db/commands/server_status_metric.cpp b/src/mongo/db/commands/server_status_metric.cpp
index 8e8b749b729..9cac3b3ecd4 100644
--- a/src/mongo/db/commands/server_status_metric.cpp
+++ b/src/mongo/db/commands/server_status_metric.cpp
@@ -49,4 +49,4 @@ string ServerStatusMetric::_parseLeafName(const string& name) {
return name.substr(idx + 1);
}
-}
+} // namespace mongo
diff --git a/src/mongo/db/commands/server_status_metric.h b/src/mongo/db/commands/server_status_metric.h
index 01c695ff046..f64327908e7 100644
--- a/src/mongo/db/commands/server_status_metric.h
+++ b/src/mongo/db/commands/server_status_metric.h
@@ -88,4 +88,4 @@ public:
private:
const T* _t;
};
-}
+} // namespace mongo
diff --git a/src/mongo/db/commands/sleep_command.cpp b/src/mongo/db/commands/sleep_command.cpp
index 67b263588e0..594422fb77e 100644
--- a/src/mongo/db/commands/sleep_command.cpp
+++ b/src/mongo/db/commands/sleep_command.cpp
@@ -174,4 +174,4 @@ public:
};
MONGO_REGISTER_TEST_COMMAND(CmdSleep);
-} // namespace
+} // namespace mongo
diff --git a/src/mongo/db/commands/snapshot_management.cpp b/src/mongo/db/commands/snapshot_management.cpp
index 3485f623c7d..01b3d7b8c74 100644
--- a/src/mongo/db/commands/snapshot_management.cpp
+++ b/src/mongo/db/commands/snapshot_management.cpp
@@ -128,4 +128,4 @@ public:
}
};
MONGO_REGISTER_TEST_COMMAND(CmdSetCommittedSnapshot);
-}
+} // namespace mongo
diff --git a/src/mongo/db/commands/test_commands.cpp b/src/mongo/db/commands/test_commands.cpp
index f11cb7c1bd4..b4ca089ae3b 100644
--- a/src/mongo/db/commands/test_commands.cpp
+++ b/src/mongo/db/commands/test_commands.cpp
@@ -209,4 +209,4 @@ public:
};
MONGO_REGISTER_TEST_COMMAND(EmptyCapped);
-}
+} // namespace mongo
diff --git a/src/mongo/db/commands/user_management_commands.cpp b/src/mongo/db/commands/user_management_commands.cpp
index 645820be5ff..ae199964060 100644
--- a/src/mongo/db/commands/user_management_commands.cpp
+++ b/src/mongo/db/commands/user_management_commands.cpp
@@ -101,8 +101,7 @@ BSONArray roleSetToBSONArray(const stdx::unordered_set<RoleName>& roles) {
++it) {
const RoleName& role = *it;
rolesArrayBuilder.append(BSON(AuthorizationManager::ROLE_NAME_FIELD_NAME
- << role.getRole()
- << AuthorizationManager::ROLE_DB_FIELD_NAME
+ << role.getRole() << AuthorizationManager::ROLE_DB_FIELD_NAME
<< role.getDB()));
}
return rolesArrayBuilder.arr();
@@ -113,8 +112,7 @@ BSONArray rolesVectorToBSONArray(const std::vector<RoleName>& roles) {
for (std::vector<RoleName>::const_iterator it = roles.begin(); it != roles.end(); ++it) {
const RoleName& role = *it;
rolesArrayBuilder.append(BSON(AuthorizationManager::ROLE_NAME_FIELD_NAME
- << role.getRole()
- << AuthorizationManager::ROLE_DB_FIELD_NAME
+ << role.getRole() << AuthorizationManager::ROLE_DB_FIELD_NAME
<< role.getDB()));
}
return rolesArrayBuilder.arr();
@@ -174,14 +172,14 @@ Status checkOkayToGrantRolesToRole(OperationContext* opCtx,
const RoleName& roleToAdd = *it;
if (roleToAdd == role) {
return Status(ErrorCodes::InvalidRoleModification,
- str::stream() << "Cannot grant role " << role.getFullName()
- << " to itself.");
+ str::stream()
+ << "Cannot grant role " << role.getFullName() << " to itself.");
}
if (role.getDB() != "admin" && roleToAdd.getDB() != role.getDB()) {
- return Status(
- ErrorCodes::InvalidRoleModification,
- str::stream() << "Roles on the \'" << role.getDB()
+ return Status(ErrorCodes::InvalidRoleModification,
+ str::stream()
+ << "Roles on the \'" << role.getDB()
<< "\' database cannot be granted roles from other databases");
}
@@ -431,14 +429,13 @@ Status insertRoleDocument(OperationContext* opCtx, const BSONObj& roleObj) {
* Updates the given role object with the given update modifier.
*/
Status updateRoleDocument(OperationContext* opCtx, const RoleName& role, const BSONObj& updateObj) {
- Status status = updateOneAuthzDocument(opCtx,
- AuthorizationManager::rolesCollectionNamespace,
- BSON(AuthorizationManager::ROLE_NAME_FIELD_NAME
- << role.getRole()
- << AuthorizationManager::ROLE_DB_FIELD_NAME
- << role.getDB()),
- updateObj,
- false);
+ Status status = updateOneAuthzDocument(
+ opCtx,
+ AuthorizationManager::rolesCollectionNamespace,
+ BSON(AuthorizationManager::ROLE_NAME_FIELD_NAME
+ << role.getRole() << AuthorizationManager::ROLE_DB_FIELD_NAME << role.getDB()),
+ updateObj,
+ false);
if (status.isOK()) {
return status;
}
@@ -516,13 +513,12 @@ Status updatePrivilegeDocument(OperationContext* opCtx,
Status updatePrivilegeDocument(OperationContext* opCtx,
const UserName& user,
const BSONObj& updateObj) {
- const auto status = updatePrivilegeDocument(opCtx,
- user,
- BSON(AuthorizationManager::USER_NAME_FIELD_NAME
- << user.getUser()
- << AuthorizationManager::USER_DB_FIELD_NAME
- << user.getDB()),
- updateObj);
+ const auto status = updatePrivilegeDocument(
+ opCtx,
+ user,
+ BSON(AuthorizationManager::USER_NAME_FIELD_NAME
+ << user.getUser() << AuthorizationManager::USER_DB_FIELD_NAME << user.getDB()),
+ updateObj);
return status;
}
@@ -621,8 +617,7 @@ StatusWith<AuthzLockGuard> requireWritableAuthSchema28SCRAM(OperationContext* op
str::stream()
<< "User and role management commands require auth data to have "
<< "at least schema version "
- << AuthorizationManager::schemaVersion28SCRAM
- << " but found "
+ << AuthorizationManager::schemaVersion28SCRAM << " but found "
<< foundSchemaVersion);
}
status = writeAuthSchemaVersionIfNeeded(opCtx, authzManager, foundSchemaVersion);
@@ -658,8 +653,7 @@ StatusWith<AuthzLockGuard> requireReadableAuthSchema26Upgrade(OperationContext*
return Status(ErrorCodes::AuthSchemaIncompatible,
str::stream() << "The usersInfo and rolesInfo commands require auth data to "
<< "have at least schema version "
- << AuthorizationManager::schemaVersion26Upgrade
- << " but found "
+ << AuthorizationManager::schemaVersion26Upgrade << " but found "
<< foundSchemaVersion);
}
@@ -2022,9 +2016,9 @@ public:
&nMatched);
if (!status.isOK()) {
uassertStatusOK(useDefaultCode(status, ErrorCodes::UserModificationFailed)
- .withContext(str::stream() << "Failed to remove role "
- << roleName.getFullName()
- << " from all users"));
+ .withContext(str::stream()
+ << "Failed to remove role " << roleName.getFullName()
+ << " from all users"));
}
// Remove this role from all other roles
@@ -2045,9 +2039,9 @@ public:
if (!status.isOK()) {
uassertStatusOK(
useDefaultCode(status, ErrorCodes::RoleModificationFailed)
- .withContext(
- str::stream() << "Removed role " << roleName.getFullName()
- << " from all users but failed to remove from all roles"));
+ .withContext(str::stream()
+ << "Removed role " << roleName.getFullName()
+ << " from all users but failed to remove from all roles"));
}
audit::logDropRole(Client::getCurrent(), roleName);
@@ -2139,13 +2133,12 @@ public:
if (!status.isOK()) {
uassertStatusOK(useDefaultCode(status, ErrorCodes::UserModificationFailed)
.withContext(str::stream() << "Failed to remove roles from \""
- << dbname
- << "\" db from all users"));
+ << dbname << "\" db from all users"));
}
// Remove these roles from all other roles
- std::string sourceFieldName = str::stream() << "roles."
- << AuthorizationManager::ROLE_DB_FIELD_NAME;
+ std::string sourceFieldName = str::stream()
+ << "roles." << AuthorizationManager::ROLE_DB_FIELD_NAME;
status = updateAuthzDocuments(
opCtx,
AuthorizationManager::rolesCollectionNamespace,
@@ -2158,8 +2151,7 @@ public:
if (!status.isOK()) {
uassertStatusOK(useDefaultCode(status, ErrorCodes::RoleModificationFailed)
.withContext(str::stream() << "Failed to remove roles from \""
- << dbname
- << "\" db from all roles"));
+ << dbname << "\" db from all roles"));
}
audit::logDropAllRolesFromDatabase(Client::getCurrent(), dbname);
@@ -2580,9 +2572,7 @@ public:
BSONObj query =
db.empty() ? BSONObj() : BSON(AuthorizationManager::USER_DB_FIELD_NAME << db);
BSONObj fields = BSON(AuthorizationManager::USER_NAME_FIELD_NAME
- << 1
- << AuthorizationManager::USER_DB_FIELD_NAME
- << 1);
+ << 1 << AuthorizationManager::USER_DB_FIELD_NAME << 1);
Status status =
queryAuthzDocument(opCtx,
@@ -2653,9 +2643,7 @@ public:
BSONObj query =
db.empty() ? BSONObj() : BSON(AuthorizationManager::ROLE_DB_FIELD_NAME << db);
BSONObj fields = BSON(AuthorizationManager::ROLE_NAME_FIELD_NAME
- << 1
- << AuthorizationManager::ROLE_DB_FIELD_NAME
- << 1);
+ << 1 << AuthorizationManager::ROLE_DB_FIELD_NAME << 1);
Status status =
queryAuthzDocument(opCtx,
diff --git a/src/mongo/db/commands/user_management_commands_common.cpp b/src/mongo/db/commands/user_management_commands_common.cpp
index 7abc55ab60a..08e4e5345c1 100644
--- a/src/mongo/db/commands/user_management_commands_common.cpp
+++ b/src/mongo/db/commands/user_management_commands_common.cpp
@@ -58,8 +58,8 @@ Status checkAuthorizedToGrantRoles(AuthorizationSession* authzSession,
for (size_t i = 0; i < roles.size(); ++i) {
if (!authzSession->isAuthorizedToGrantRole(roles[i])) {
return Status(ErrorCodes::Unauthorized,
- str::stream() << "Not authorized to grant role: "
- << roles[i].getFullName());
+ str::stream()
+ << "Not authorized to grant role: " << roles[i].getFullName());
}
}
@@ -83,8 +83,8 @@ Status checkAuthorizedToRevokeRoles(AuthorizationSession* authzSession,
for (size_t i = 0; i < roles.size(); ++i) {
if (!authzSession->isAuthorizedToRevokeRole(roles[i])) {
return Status(ErrorCodes::Unauthorized,
- str::stream() << "Not authorized to revoke role: "
- << roles[i].getFullName());
+ str::stream()
+ << "Not authorized to revoke role: " << roles[i].getFullName());
}
}
return Status::OK();
@@ -129,8 +129,8 @@ Status checkAuthForCreateUserCommand(Client* client,
if (!authzSession->isAuthorizedForActionsOnResource(
ResourcePattern::forDatabaseName(args.userName.getDB()), ActionType::createUser)) {
return Status(ErrorCodes::Unauthorized,
- str::stream() << "Not authorized to create users on db: "
- << args.userName.getDB());
+ str::stream()
+ << "Not authorized to create users on db: " << args.userName.getDB());
}
status = checkAuthorizedToGrantRoles(authzSession, args.roles);
@@ -231,8 +231,8 @@ Status checkAuthForCreateRoleCommand(Client* client,
if (!authzSession->isAuthorizedToCreateRole(args)) {
return Status(ErrorCodes::Unauthorized,
- str::stream() << "Not authorized to create roles on db: "
- << args.roleName.getDB());
+ str::stream()
+ << "Not authorized to create roles on db: " << args.roleName.getDB());
}
status = checkAuthorizedToGrantRoles(authzSession, args.roles);
@@ -365,8 +365,8 @@ Status checkAuthForDropAllUsersFromDatabaseCommand(Client* client, const std::st
if (!authzSession->isAuthorizedForActionsOnResource(ResourcePattern::forDatabaseName(dbname),
ActionType::dropUser)) {
return Status(ErrorCodes::Unauthorized,
- str::stream() << "Not authorized to drop users from the " << dbname
- << " database");
+ str::stream()
+ << "Not authorized to drop users from the " << dbname << " database");
}
return Status::OK();
}
@@ -415,8 +415,8 @@ Status checkAuthForUsersInfoCommand(Client* client,
if (!authzSession->isAuthorizedForActionsOnResource(
ResourcePattern::forDatabaseName(dbname), ActionType::viewUser)) {
return Status(ErrorCodes::Unauthorized,
- str::stream() << "Not authorized to view users from the " << dbname
- << " database");
+ str::stream()
+ << "Not authorized to view users from the " << dbname << " database");
}
} else if (args.target == auth::UsersInfoArgs::Target::kGlobal) {
if (!authzSession->isAuthorizedForActionsOnResource(ResourcePattern::forClusterResource(),
@@ -462,8 +462,8 @@ Status checkAuthForDropAllRolesFromDatabaseCommand(Client* client, const std::st
if (!authzSession->isAuthorizedForActionsOnResource(ResourcePattern::forDatabaseName(dbname),
ActionType::dropRole)) {
return Status(ErrorCodes::Unauthorized,
- str::stream() << "Not authorized to drop roles from the " << dbname
- << " database");
+ str::stream()
+ << "Not authorized to drop roles from the " << dbname << " database");
}
return Status::OK();
}
@@ -482,8 +482,8 @@ Status checkAuthForRolesInfoCommand(Client* client,
if (!authzSession->isAuthorizedForActionsOnResource(
ResourcePattern::forDatabaseName(dbname), ActionType::viewRole)) {
return Status(ErrorCodes::Unauthorized,
- str::stream() << "Not authorized to view roles from the " << dbname
- << " database");
+ str::stream()
+ << "Not authorized to view roles from the " << dbname << " database");
}
} else {
for (size_t i = 0; i < args.roleNames.size(); ++i) {
@@ -496,8 +496,7 @@ Status checkAuthForRolesInfoCommand(Client* client,
ActionType::viewRole)) {
return Status(ErrorCodes::Unauthorized,
str::stream() << "Not authorized to view roles from the "
- << args.roleNames[i].getDB()
- << " database");
+ << args.roleNames[i].getDB() << " database");
}
}
}
diff --git a/src/mongo/db/commands/validate.cpp b/src/mongo/db/commands/validate.cpp
index a6505b464d5..f0eafc0d873 100644
--- a/src/mongo/db/commands/validate.cpp
+++ b/src/mongo/db/commands/validate.cpp
@@ -212,4 +212,4 @@ public:
}
} validateCmd;
-}
+} // namespace mongo
diff --git a/src/mongo/db/commands/write_commands/write_commands.cpp b/src/mongo/db/commands/write_commands/write_commands.cpp
index a98505ded6d..7fa3bb3c82b 100644
--- a/src/mongo/db/commands/write_commands/write_commands.cpp
+++ b/src/mongo/db/commands/write_commands/write_commands.cpp
@@ -111,7 +111,7 @@ void serializeReply(OperationContext* opCtx,
BSONSizeTracker upsertInfoSizeTracker;
BSONSizeTracker errorsSizeTracker;
- auto errorMessage = [&, errorSize = size_t(0) ](StringData rawMessage) mutable {
+ auto errorMessage = [&, errorSize = size_t(0)](StringData rawMessage) mutable {
// Start truncating error messages once both of these limits are exceeded.
constexpr size_t kErrorSizeTruncationMin = 1024 * 1024;
constexpr size_t kErrorCountTruncationMin = 2;