diff options
author | Henrik Edin <henrik.edin@mongodb.com> | 2020-04-09 16:29:36 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-04-20 15:41:45 +0000 |
commit | fccca7a804efdaf008ba859ceeb09d62444b2738 (patch) | |
tree | 15c291a2fb065caa4183b3ccd759c0d4ff3703b6 /src/mongo/db/bson/dotted_path_support.cpp | |
parent | 61f5d6cf5087d656ebc4bbd2bf75a0a5eacb9cad (diff) | |
download | mongo-fccca7a804efdaf008ba859ceeb09d62444b2738.tar.gz |
SERVER-47476 Use small_vector to be able to store a few multikey components without allocating memory
Also cleaned up FieldRef
Diffstat (limited to 'src/mongo/db/bson/dotted_path_support.cpp')
-rw-r--r-- | src/mongo/db/bson/dotted_path_support.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/mongo/db/bson/dotted_path_support.cpp b/src/mongo/db/bson/dotted_path_support.cpp index 4860e5dfd66..0595c8baf0f 100644 --- a/src/mongo/db/bson/dotted_path_support.cpp +++ b/src/mongo/db/bson/dotted_path_support.cpp @@ -52,13 +52,14 @@ void _extractAllElementsAlongPath(const BSONObj& obj, StringData path, BSONElementColl& elements, bool expandArrayOnTrailingField, - size_t depth, + BSONDepthIndex depth, MultikeyComponents* arrayComponents) { BSONElement e = obj.getField(path); if (e.eoo()) { size_t idx = path.find('.'); if (idx != std::string::npos) { + invariant(depth != std::numeric_limits<BSONDepthIndex>::max()); StringData left = path.substr(0, idx); StringData next = path.substr(idx + 1, path.size()); @@ -166,7 +167,7 @@ void extractAllElementsAlongPath(const BSONObj& obj, BSONElementSet& elements, bool expandArrayOnTrailingField, MultikeyComponents* arrayComponents) { - const size_t initialDepth = 0; + const BSONDepthIndex initialDepth = 0; _extractAllElementsAlongPath( obj, path, elements, expandArrayOnTrailingField, initialDepth, arrayComponents); } @@ -176,7 +177,7 @@ void extractAllElementsAlongPath(const BSONObj& obj, BSONElementMultiSet& elements, bool expandArrayOnTrailingField, MultikeyComponents* arrayComponents) { - const size_t initialDepth = 0; + const BSONDepthIndex initialDepth = 0; _extractAllElementsAlongPath( obj, path, elements, expandArrayOnTrailingField, initialDepth, arrayComponents); } |