summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline
diff options
context:
space:
mode:
authorBilly Donahue <billy.donahue@mongodb.com>2019-04-08 16:27:50 -0400
committerBilly Donahue <billy.donahue@mongodb.com>2019-04-09 15:38:40 -0400
commit1041dd848e25e879260d1015d8da4f72ee7993fe (patch)
treef8ddb4ee7c841e4ef790ea7bd53e75c0a09c4cc2 /src/mongo/db/pipeline
parent8cdc51e7810f7fd8898a4c60b935e389f04659ee (diff)
downloadmongo-1041dd848e25e879260d1015d8da4f72ee7993fe.tar.gz
SERVER-40476 remove mongoutils::str
Rename utils/mongoutils/str.h => utils/str.h Rename namespace mongoutils::str => str Rename mongo::strcasecmp => str::caseInsensitiveCompare.
Diffstat (limited to 'src/mongo/db/pipeline')
-rw-r--r--src/mongo/db/pipeline/accumulation_statement.cpp2
-rw-r--r--src/mongo/db/pipeline/dependencies.cpp32
-rw-r--r--src/mongo/db/pipeline/document.cpp3
-rw-r--r--src/mongo/db/pipeline/document_source_current_op_test.cpp2
-rw-r--r--src/mongo/db/pipeline/document_source_facet.cpp2
-rw-r--r--src/mongo/db/pipeline/document_source_graph_lookup_test.cpp2
-rw-r--r--src/mongo/db/pipeline/expression.cpp4
-rw-r--r--src/mongo/db/pipeline/expression.h25
-rw-r--r--src/mongo/db/pipeline/field_path.cpp2
-rw-r--r--src/mongo/db/pipeline/parsed_aggregation_projection.cpp2
-rw-r--r--src/mongo/db/pipeline/pipeline.cpp2
-rw-r--r--src/mongo/db/pipeline/pipeline_metadata_tree_test.cpp2
-rw-r--r--src/mongo/db/pipeline/value.cpp3
-rw-r--r--src/mongo/db/pipeline/variables.cpp2
14 files changed, 36 insertions, 49 deletions
diff --git a/src/mongo/db/pipeline/accumulation_statement.cpp b/src/mongo/db/pipeline/accumulation_statement.cpp
index 4c191f1ed3d..d47c507c6d9 100644
--- a/src/mongo/db/pipeline/accumulation_statement.cpp
+++ b/src/mongo/db/pipeline/accumulation_statement.cpp
@@ -36,7 +36,7 @@
#include "mongo/db/pipeline/accumulator.h"
#include "mongo/db/pipeline/value.h"
#include "mongo/util/assert_util.h"
-#include "mongo/util/mongoutils/str.h"
+#include "mongo/util/str.h"
#include "mongo/util/string_map.h"
namespace mongo {
diff --git a/src/mongo/db/pipeline/dependencies.cpp b/src/mongo/db/pipeline/dependencies.cpp
index 8849a98c3e5..6bfdc19bdce 100644
--- a/src/mongo/db/pipeline/dependencies.cpp
+++ b/src/mongo/db/pipeline/dependencies.cpp
@@ -32,16 +32,10 @@
#include "mongo/db/jsobj.h"
#include "mongo/db/pipeline/dependencies.h"
#include "mongo/db/pipeline/field_path.h"
-#include "mongo/util/mongoutils/str.h"
+#include "mongo/util/str.h"
namespace mongo {
-using std::set;
-using std::string;
-using std::vector;
-
-namespace str = mongoutils::str;
-
constexpr DepsTracker::MetadataAvailable DepsTracker::kAllGeoNearDataAvailable;
bool DepsTracker::_appendMetaProjections(BSONObjBuilder* projectionBuilder) const {
@@ -90,15 +84,15 @@ BSONObj DepsTracker::toProjection() const {
}
bool needId = false;
- string last;
- for (set<string>::const_iterator it(fields.begin()), end(fields.end()); it != end; ++it) {
- if (str::startsWith(*it, "_id") && (it->size() == 3 || (*it)[3] == '.')) {
+ std::string last;
+ for (const auto& field : fields) {
+ if (str::startsWith(field, "_id") && (field.size() == 3 || field[3] == '.')) {
// _id and subfields are handled specially due in part to SERVER-7502
needId = true;
continue;
}
- if (!last.empty() && str::startsWith(*it, last)) {
+ if (!last.empty() && str::startsWith(field, last)) {
// we are including a parent of *it so we don't need to include this field
// explicitly. In fact, due to SERVER-6527 if we included this field, the parent
// wouldn't be fully included. This logic relies on on set iterators going in
@@ -107,8 +101,8 @@ BSONObj DepsTracker::toProjection() const {
continue;
}
- last = *it + '.';
- bb.append(*it, 1);
+ last = field + '.';
+ bb.append(field, 1);
}
if (needId) // we are explicit either way
@@ -131,17 +125,17 @@ boost::optional<ParsedDeps> DepsTracker::toParsedDeps() const {
return boost::none;
}
- string last;
- for (set<string>::const_iterator it(fields.begin()), end(fields.end()); it != end; ++it) {
- if (!last.empty() && str::startsWith(*it, last)) {
+ std::string last;
+ for (const auto& field : fields) {
+ if (!last.empty() && str::startsWith(field, last)) {
// we are including a parent of *it so we don't need to include this field
// explicitly. In fact, if we included this field, the parent wouldn't be fully
// included. This logic relies on on set iterators going in lexicographic order so
// that a string is always directly before of all fields it prefixes.
continue;
}
- last = *it + '.';
- md.setNestedField(*it, Value(true));
+ last = field + '.';
+ md.setNestedField(field, Value(true));
}
return ParsedDeps(md.freeze());
@@ -230,7 +224,7 @@ Document documentHelper(const BSONObj& bson, const Document& neededFields, int n
Value arrayHelper(const BSONObj& bson, const Document& neededFields) {
BSONObjIterator it(bson);
- vector<Value> values;
+ std::vector<Value> values;
while (it.more()) {
BSONElement bsonElement(it.next());
if (bsonElement.type() == Object) {
diff --git a/src/mongo/db/pipeline/document.cpp b/src/mongo/db/pipeline/document.cpp
index 5758b198589..7d0d23ed24c 100644
--- a/src/mongo/db/pipeline/document.cpp
+++ b/src/mongo/db/pipeline/document.cpp
@@ -36,10 +36,9 @@
#include "mongo/bson/bson_depth.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/pipeline/field_path.h"
-#include "mongo/util/mongoutils/str.h"
+#include "mongo/util/str.h"
namespace mongo {
-using namespace mongoutils;
using boost::intrusive_ptr;
using std::string;
using std::vector;
diff --git a/src/mongo/db/pipeline/document_source_current_op_test.cpp b/src/mongo/db/pipeline/document_source_current_op_test.cpp
index 0ab59c42180..7f72327a51c 100644
--- a/src/mongo/db/pipeline/document_source_current_op_test.cpp
+++ b/src/mongo/db/pipeline/document_source_current_op_test.cpp
@@ -36,7 +36,7 @@
#include "mongo/db/pipeline/stub_mongo_process_interface.h"
#include "mongo/unittest/unittest.h"
#include "mongo/util/assert_util.h"
-#include "mongo/util/mongoutils/str.h"
+#include "mongo/util/str.h"
namespace mongo {
diff --git a/src/mongo/db/pipeline/document_source_facet.cpp b/src/mongo/db/pipeline/document_source_facet.cpp
index c3085279e8f..3c9b55bb215 100644
--- a/src/mongo/db/pipeline/document_source_facet.cpp
+++ b/src/mongo/db/pipeline/document_source_facet.cpp
@@ -47,7 +47,7 @@
#include "mongo/db/pipeline/value.h"
#include "mongo/stdx/memory.h"
#include "mongo/util/assert_util.h"
-#include "mongo/util/mongoutils/str.h"
+#include "mongo/util/str.h"
namespace mongo {
diff --git a/src/mongo/db/pipeline/document_source_graph_lookup_test.cpp b/src/mongo/db/pipeline/document_source_graph_lookup_test.cpp
index c322469e8a8..f0fae26f470 100644
--- a/src/mongo/db/pipeline/document_source_graph_lookup_test.cpp
+++ b/src/mongo/db/pipeline/document_source_graph_lookup_test.cpp
@@ -40,7 +40,7 @@
#include "mongo/db/pipeline/stub_mongo_process_interface.h"
#include "mongo/unittest/unittest.h"
#include "mongo/util/assert_util.h"
-#include "mongo/util/mongoutils/str.h"
+#include "mongo/util/str.h"
namespace mongo {
diff --git a/src/mongo/db/pipeline/expression.cpp b/src/mongo/db/pipeline/expression.cpp
index 864ca057945..364f8804cd9 100644
--- a/src/mongo/db/pipeline/expression.cpp
+++ b/src/mongo/db/pipeline/expression.cpp
@@ -47,16 +47,14 @@
#include "mongo/db/query/datetime/date_time_support.h"
#include "mongo/platform/bits.h"
#include "mongo/platform/decimal128.h"
-#include "mongo/util/mongoutils/str.h"
#include "mongo/util/regex_util.h"
+#include "mongo/util/str.h"
#include "mongo/util/string_map.h"
#include "mongo/util/summation.h"
namespace mongo {
using Parser = Expression::Parser;
-using namespace mongoutils;
-
using boost::intrusive_ptr;
using std::map;
using std::move;
diff --git a/src/mongo/db/pipeline/expression.h b/src/mongo/db/pipeline/expression.h
index f5b7ec4fc12..e98798f6d78 100644
--- a/src/mongo/db/pipeline/expression.h
+++ b/src/mongo/db/pipeline/expression.h
@@ -48,7 +48,7 @@
#include "mongo/db/server_options.h"
#include "mongo/stdx/functional.h"
#include "mongo/util/intrusive_counter.h"
-#include "mongo/util/mongoutils/str.h"
+#include "mongo/util/str.h"
namespace mongo {
@@ -343,14 +343,12 @@ public:
void validateArguments(const Expression::ExpressionVector& args) const override {
uassert(28667,
- mongoutils::str::stream() << "Expression " << this->getOpName()
- << " takes at least "
- << MinArgs
- << " arguments, and at most "
- << MaxArgs
- << ", but "
- << args.size()
- << " were passed in.",
+ str::stream() << "Expression " << this->getOpName() << " takes at least " << MinArgs
+ << " arguments, and at most "
+ << MaxArgs
+ << ", but "
+ << args.size()
+ << " were passed in.",
MinArgs <= args.size() && args.size() <= MaxArgs);
}
};
@@ -364,11 +362,10 @@ public:
void validateArguments(const Expression::ExpressionVector& args) const override {
uassert(16020,
- mongoutils::str::stream() << "Expression " << this->getOpName() << " takes exactly "
- << NArgs
- << " arguments. "
- << args.size()
- << " were passed in.",
+ str::stream() << "Expression " << this->getOpName() << " takes exactly " << NArgs
+ << " arguments. "
+ << args.size()
+ << " were passed in.",
args.size() == NArgs);
}
};
diff --git a/src/mongo/db/pipeline/field_path.cpp b/src/mongo/db/pipeline/field_path.cpp
index dab64594e71..bb26fc478ca 100644
--- a/src/mongo/db/pipeline/field_path.cpp
+++ b/src/mongo/db/pipeline/field_path.cpp
@@ -33,7 +33,7 @@
#include "mongo/base/string_data.h"
#include "mongo/bson/bson_depth.h"
-#include "mongo/util/mongoutils/str.h"
+#include "mongo/util/str.h"
namespace mongo {
diff --git a/src/mongo/db/pipeline/parsed_aggregation_projection.cpp b/src/mongo/db/pipeline/parsed_aggregation_projection.cpp
index 5c431e17798..3f283079ac4 100644
--- a/src/mongo/db/pipeline/parsed_aggregation_projection.cpp
+++ b/src/mongo/db/pipeline/parsed_aggregation_projection.cpp
@@ -42,7 +42,7 @@
#include "mongo/db/pipeline/parsed_inclusion_projection.h"
#include "mongo/stdx/unordered_set.h"
#include "mongo/util/assert_util.h"
-#include "mongo/util/mongoutils/str.h"
+#include "mongo/util/str.h"
namespace mongo {
namespace parsed_aggregation_projection {
diff --git a/src/mongo/db/pipeline/pipeline.cpp b/src/mongo/db/pipeline/pipeline.cpp
index 677daa986f8..3728f5b503c 100644
--- a/src/mongo/db/pipeline/pipeline.cpp
+++ b/src/mongo/db/pipeline/pipeline.cpp
@@ -51,7 +51,7 @@
#include "mongo/db/pipeline/expression.h"
#include "mongo/db/pipeline/expression_context.h"
#include "mongo/util/fail_point_service.h"
-#include "mongo/util/mongoutils/str.h"
+#include "mongo/util/str.h"
namespace mongo {
diff --git a/src/mongo/db/pipeline/pipeline_metadata_tree_test.cpp b/src/mongo/db/pipeline/pipeline_metadata_tree_test.cpp
index 46a816ad22e..128b820b753 100644
--- a/src/mongo/db/pipeline/pipeline_metadata_tree_test.cpp
+++ b/src/mongo/db/pipeline/pipeline_metadata_tree_test.cpp
@@ -63,7 +63,7 @@
try { \
EXPRESSION; \
} catch (const AssertionException& e) { \
- ::mongoutils::str::stream err; \
+ ::mongo::str::stream err; \
err << "Threw an exception incorrectly: " << e.toString() \
<< " Exception occured in: " << #EXPRESSION; \
::mongo::unittest::TestAssertionFailure(__FILE__, __LINE__, err).stream(); \
diff --git a/src/mongo/db/pipeline/value.cpp b/src/mongo/db/pipeline/value.cpp
index c4ee8c848b4..e8961ead90a 100644
--- a/src/mongo/db/pipeline/value.cpp
+++ b/src/mongo/db/pipeline/value.cpp
@@ -45,11 +45,10 @@
#include "mongo/db/query/datetime/date_time_support.h"
#include "mongo/platform/decimal128.h"
#include "mongo/util/hex.h"
-#include "mongo/util/mongoutils/str.h"
#include "mongo/util/represent_as.h"
+#include "mongo/util/str.h"
namespace mongo {
-using namespace mongoutils;
using boost::intrusive_ptr;
using std::min;
using std::numeric_limits;
diff --git a/src/mongo/db/pipeline/variables.cpp b/src/mongo/db/pipeline/variables.cpp
index c4d812831de..d8a17fe72d2 100644
--- a/src/mongo/db/pipeline/variables.cpp
+++ b/src/mongo/db/pipeline/variables.cpp
@@ -32,7 +32,7 @@
#include "mongo/db/logical_clock.h"
#include "mongo/platform/basic.h"
#include "mongo/platform/random.h"
-#include "mongo/util/mongoutils/str.h"
+#include "mongo/util/str.h"
#include "mongo/util/time_support.h"
namespace mongo {