summaryrefslogtreecommitdiff
path: root/src/mongo/bson/bson_depth.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/bson/bson_depth.h')
-rw-r--r--src/mongo/bson/bson_depth.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/mongo/bson/bson_depth.h b/src/mongo/bson/bson_depth.h
index e7e6836a8bf..ee0c7a2f235 100644
--- a/src/mongo/bson/bson_depth.h
+++ b/src/mongo/bson/bson_depth.h
@@ -39,16 +39,17 @@ struct BSONDepth {
// The default BSON depth nesting limit.
static constexpr std::int32_t kDefaultMaxAllowableDepth = 200;
- // The minimum allowable value for the BSON depth parameter.
- static constexpr std::int32_t kBSONDepthParameterFloor = 5;
-
- // The maximum allowable value for the BSON depth parameter.
- static constexpr std::int32_t kBSONDepthParameterCeiling = 250;
-
// The number of extra levels of nesting above the storage depth limit that the server will
// tolerate.
static constexpr std::uint32_t kExtraSystemDepthLevels = 20;
+ // The minimum allowable value for the BSON depth parameter. Choose a value such that the max
+ // depth for user storage will be at least 1.
+ static constexpr std::int32_t kBSONDepthParameterFloor = kExtraSystemDepthLevels + 1;
+
+ // The maximum allowable value for the BSON depth parameter.
+ static constexpr std::int32_t kBSONDepthParameterCeiling = 250;
+
// The depth of BSON accepted by the server. Configurable via the 'maxBSONDepth' server
// parameter.
static std::int32_t maxAllowableDepth;