diff options
author | Andrii Dobroshynski <andrii.dobroshynski@mongodb.com> | 2022-02-05 18:02:46 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-02-05 18:49:41 +0000 |
commit | a1e5f50b2d3f162b4ade24ef4cf8035855bf5658 (patch) | |
tree | 7cfd61404afc63ce55628c136eb48701c19ebacb /src/mongo/db/query/index_bounds.cpp | |
parent | 8819693dce1282c2e93aa49c488473cb12429cec (diff) | |
download | mongo-a1e5f50b2d3f162b4ade24ef4cf8035855bf5658.tar.gz |
SERVER-60298 Hex encode the index bounds if associated with collation
Diffstat (limited to 'src/mongo/db/query/index_bounds.cpp')
-rw-r--r-- | src/mongo/db/query/index_bounds.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/mongo/db/query/index_bounds.cpp b/src/mongo/db/query/index_bounds.cpp index 8703368fcbd..d5f3e90733f 100644 --- a/src/mongo/db/query/index_bounds.cpp +++ b/src/mongo/db/query/index_bounds.cpp @@ -126,11 +126,11 @@ bool IndexBounds::operator!=(const IndexBounds& other) const { return !(*this == other); } -string OrderedIntervalList::toString() const { +string OrderedIntervalList::toString(bool hasNonSimpleCollation) const { str::stream ss; ss << "['" << name << "']: "; for (size_t j = 0; j < intervals.size(); ++j) { - ss << intervals[j].toString(); + ss << intervals[j].toString(hasNonSimpleCollation); if (j < intervals.size() - 1) { ss << ", "; } @@ -305,7 +305,7 @@ void OrderedIntervalList::complement() { intervals.insert(intervals.end(), newIntervals.begin(), newIntervals.end()); } -string IndexBounds::toString() const { +string IndexBounds::toString(bool hasNonSimpleCollation) const { str::stream ss; if (isSimpleRange) { if (IndexBounds::isStartIncludedInBound(boundInclusion)) { @@ -330,13 +330,13 @@ string IndexBounds::toString() const { if (i > 0) { ss << ", "; } - ss << "field #" << i << fields[i].toString(); + ss << "field #" << i << fields[i].toString(hasNonSimpleCollation); } return ss; } -BSONObj IndexBounds::toBSON() const { +BSONObj IndexBounds::toBSON(bool hasNonSimpleCollation) const { BSONObjBuilder bob; vector<OrderedIntervalList>::const_iterator itField; for (itField = fields.begin(); itField != fields.end(); ++itField) { @@ -345,8 +345,7 @@ BSONObj IndexBounds::toBSON() const { vector<Interval>::const_iterator itInterval; for (itInterval = itField->intervals.begin(); itInterval != itField->intervals.end(); ++itInterval) { - std::string intervalStr = itInterval->toString(); - + std::string intervalStr = itInterval->toString(hasNonSimpleCollation); // Insulate against hitting BSON size limit. if ((bob.len() + (int)intervalStr.size()) > BSONObjMaxUserSize) { fieldBuilder.append("warning: bounds truncated due to BSON size limit"); |