diff options
| author | Antonin Kral <a.kral@bobek.cz> | 2013-07-17 16:21:49 +0200 |
|---|---|---|
| committer | Antonin Kral <a.kral@bobek.cz> | 2013-07-17 16:21:49 +0200 |
| commit | e3904bf97e74cbbe5dde6b3abc3e797ad7d26b5d (patch) | |
| tree | f2d76fa86bfce0e897a616e02551bdd7d9913682 /src/mongo/db/instance.cpp | |
| parent | bef4346b845150d5318fd7a0acb43554f0d40a06 (diff) | |
Imported Upstream version 2.4.5upstream/2.4.5
Diffstat (limited to 'src/mongo/db/instance.cpp')
| -rw-r--r-- | src/mongo/db/instance.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/mongo/db/instance.cpp b/src/mongo/db/instance.cpp index 2daee09b14d..926cdeecdb6 100644 --- a/src/mongo/db/instance.cpp +++ b/src/mongo/db/instance.cpp @@ -777,13 +777,21 @@ namespace mongo { void checkAndInsert(const char *ns, /*modifies*/BSONObj& js) { uassert( 10059 , "object to insert too large", js.objsize() <= BSONObjMaxUserSize); { - // check no $ modifiers. note we only check top level. (scanning deep would be quite expensive) BSONObjIterator i( js ); while ( i.more() ) { BSONElement e = i.next(); - uassert( 13511 , "document to insert can't have $ fields" , e.fieldName()[0] != '$' ); + + // check no $ modifiers. note we only check top level. + // (scanning deep would be quite expensive) + uassert( 13511, "document to insert can't have $ fields", e.fieldName()[0] != '$' ); + + // check no regexp for _id (SERVER-9502) + if (str::equals(e.fieldName(), "_id")) { + uassert(16824, "can't use a regex for _id", e.type() != RegEx); + } } } + theDataFileMgr.insertWithObjMod(ns, // May be modified in the call to add an _id field. js, |
