diff options
author | Scott Hernandez <scotthernandez@gmail.com> | 2014-04-25 11:07:44 -0400 |
---|---|---|
committer | Scott Hernandez <scotthernandez@gmail.com> | 2014-04-25 13:08:55 -0400 |
commit | 00ffa832253b99f4678ae2d0afd561e13add0d94 (patch) | |
tree | d3659a8861bdeca1126db809dfd90cb9415ee4b3 /jstests/core/regex_not_id.js | |
parent | 84ea70be95e75eacddb05a8b85167741ec699556 (diff) | |
download | mongo-00ffa832253b99f4678ae2d0afd561e13add0d94.tar.gz |
SERVER-13710: Cleanup Replication Tests
Diffstat (limited to 'jstests/core/regex_not_id.js')
-rw-r--r-- | jstests/core/regex_not_id.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/jstests/core/regex_not_id.js b/jstests/core/regex_not_id.js new file mode 100644 index 00000000000..6eb5a4e7bfd --- /dev/null +++ b/jstests/core/regex_not_id.js @@ -0,0 +1,12 @@ +// don't allow regex as _id: SERVER-9502 + +var testColl = db.regex_not_id; +testColl.drop() + +assert.writeOK(testColl.insert({ _id: "ABCDEF1" }, {writeConcern:{w:1}})); + +// Should be an error. +assert.writeError(testColl.insert({ _id: /^A/ }, {writeConcern:{w:1}})); + +// _id doesn't have to be first; still disallowed +assert.writeError(testColl.insert({ xxx: "ABCDEF", _id: /ABCDEF/ }, {writeConcern:{w:1}}));
\ No newline at end of file |