summaryrefslogtreecommitdiff
path: root/src/mongo/db/update/addtoset_node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/update/addtoset_node.cpp')
-rw-r--r--src/mongo/db/update/addtoset_node.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mongo/db/update/addtoset_node.cpp b/src/mongo/db/update/addtoset_node.cpp
index f7b821815d1..824f6943c8e 100644
--- a/src/mongo/db/update/addtoset_node.cpp
+++ b/src/mongo/db/update/addtoset_node.cpp
@@ -85,7 +85,10 @@ Status AddToSetNode::init(BSONElement modExpr,
str::stream() << "Found unexpected fields after $each in $addToSet: "
<< modExpr.Obj());
}
- _elements = firstElement.Array();
+
+ // We call 'ArrayVerifyIndexes' to uassert in the event that 'firstElement' is a
+ // BSONArray with invalid indexes.
+ _elements = firstElement.ArrayVerifyIndexes();
}
}