summaryrefslogtreecommitdiff
path: root/src/mongo/db/instance.cpp
diff options
context:
space:
mode:
authorScott Hernandez <scotthernandez@gmail.com>2013-09-27 22:29:33 -0400
committerScott Hernandez <scotthernandez@gmail.com>2013-09-27 22:29:33 -0400
commit68b9892772fc012dc4d15bef8deb19bc2af8cdaf (patch)
treed44acdb8f65fb6ccc213c1cec9d9d1fff8a2a77e /src/mongo/db/instance.cpp
parent02d5e9521f71e1a090da489a594087352a00016c (diff)
downloadmongo-68b9892772fc012dc4d15bef8deb19bc2af8cdaf.tar.gz
SERVER-10518: disallow _id field arrays and undefined
Diffstat (limited to 'src/mongo/db/instance.cpp')
-rw-r--r--src/mongo/db/instance.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mongo/db/instance.cpp b/src/mongo/db/instance.cpp
index 11ec82eaa8e..83f763fa06a 100644
--- a/src/mongo/db/instance.cpp
+++ b/src/mongo/db/instance.cpp
@@ -863,8 +863,11 @@ namespace mongo {
e.fieldName()[0] != '$' );
// check no regexp for _id (SERVER-9502)
+ // also, disallow undefined and arrays
if (str::equals(e.fieldName(), "_id")) {
uassert(16824, "can't use a regex for _id", e.type() != RegEx);
+ uassert(17150, "can't use undefined for _id", e.type() != Undefined);
+ uassert(17151, "can't use an array for _id", e.type() != Array);
}
}
}