summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/update.cpp
diff options
context:
space:
mode:
authorTess Avitabile <tess.avitabile@mongodb.com>2017-06-15 10:01:54 -0400
committerTess Avitabile <tess.avitabile@mongodb.com>2017-06-19 10:29:10 -0400
commitab165e7a81e319cd7e99af3e1eed86e826fd34ba (patch)
tree9bfbc962946848d8bc97d208e1aabdf0e0363915 /src/mongo/db/exec/update.cpp
parent0d7f9a01b1ae168b8adfc02bb1eb0c1616138d38 (diff)
downloadmongo-ab165e7a81e319cd7e99af3e1eed86e826fd34ba.tar.gz
SERVER-28762 Conditionally parse an update expression as an UpdateNode tree
Diffstat (limited to 'src/mongo/db/exec/update.cpp')
-rw-r--r--src/mongo/db/exec/update.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mongo/db/exec/update.cpp b/src/mongo/db/exec/update.cpp
index 90cd46ab423..87145233e3d 100644
--- a/src/mongo/db/exec/update.cpp
+++ b/src/mongo/db/exec/update.cpp
@@ -89,7 +89,7 @@ StatusWith<std::uint32_t> storageValidChildren(const mb::ConstElement&,
StatusWith<std::uint32_t> storageValid(const mb::Document& doc,
bool deep,
std::uint32_t recursionLevel) {
- if (recursionLevel >= BSONDepth::getMaxDepthForUserStorage()) {
+ if (recursionLevel > BSONDepth::getMaxDepthForUserStorage()) {
return Status(ErrorCodes::Overflow,
str::stream() << "Document exceeds maximum nesting depth of "
<< BSONDepth::getMaxDepthForUserStorage());
@@ -203,7 +203,7 @@ Status validateDollarPrefixElement(const mb::ConstElement elem, const bool deep)
*/
StatusWith<std::uint32_t> storageValidParents(const mb::ConstElement& elem,
std::uint32_t recursionLevel) {
- if (recursionLevel >= BSONDepth::getMaxDepthForUserStorage()) {
+ if (recursionLevel > BSONDepth::getMaxDepthForUserStorage()) {
return Status(ErrorCodes::Overflow,
str::stream() << "Document exceeds maximum nesting depth of "
<< BSONDepth::getMaxDepthForUserStorage());
@@ -232,7 +232,7 @@ StatusWith<std::uint32_t> storageValid(const mb::ConstElement& elem,
if (!elem.ok())
return Status(ErrorCodes::BadValue, "Invalid elements cannot be stored.");
- if (recursionLevel >= BSONDepth::getMaxDepthForUserStorage()) {
+ if (recursionLevel > BSONDepth::getMaxDepthForUserStorage()) {
return Status(ErrorCodes::Overflow,
str::stream() << "Document exceeds maximum nesting depth of "
<< BSONDepth::getMaxDepthForUserStorage());
@@ -322,7 +322,7 @@ inline Status validate(const BSONObj& original,
if (opts.enforceOkForStorage) {
// No specific fields were updated so the whole doc must be checked
const bool doRecursiveCheck = true;
- const std::uint32_t recursionLevel = 1;
+ const std::uint32_t recursionLevel = 0;
auto documentDepth = storageValid(updated, doRecursiveCheck, recursionLevel);
if (!documentDepth.isOK()) {
return documentDepth.getStatus();