diff options
author | Dianna Hohensee <dianna.hohensee@10gen.com> | 2017-05-31 10:07:52 -0400 |
---|---|---|
committer | Dianna Hohensee <dianna.hohensee@10gen.com> | 2017-06-02 08:52:09 -0400 |
commit | 7ae19ef3ae9a4555ff71acf8e44f34775b130d3e (patch) | |
tree | 1dd9fca49a0cfbaea617ddb49c1a682d491c723b /src/mongo/dbtests/jsobjtests.cpp | |
parent | b1232f05862ab624912319acc673b37f591a1619 (diff) | |
download | mongo-7ae19ef3ae9a4555ff71acf8e44f34775b130d3e.tar.gz |
SERVER-29334 remove dotted field name check from BSONObj::okForStorage
Diffstat (limited to 'src/mongo/dbtests/jsobjtests.cpp')
-rw-r--r-- | src/mongo/dbtests/jsobjtests.cpp | 31 |
1 files changed, 2 insertions, 29 deletions
diff --git a/src/mongo/dbtests/jsobjtests.cpp b/src/mongo/dbtests/jsobjtests.cpp index 917488bd1c0..beef2906811 100644 --- a/src/mongo/dbtests/jsobjtests.cpp +++ b/src/mongo/dbtests/jsobjtests.cpp @@ -2038,7 +2038,7 @@ public: } void good(BSONObj o) { - if (o.okForStorageAsRoot()) + if (o.storageValidEmbedded().isOK()) return; throw UserException(12528, (string) "should be ok for storage:" + o.toString()); } @@ -2048,7 +2048,7 @@ public: } void bad(BSONObj o) { - if (!o.okForStorageAsRoot()) + if (!o.storageValidEmbedded().isOK()) return; throw UserException(12529, (string) "should NOT be ok for storage:" + o.toString()); } @@ -2059,10 +2059,6 @@ public: good("{x:1}"); good("{x:{a:2}}"); - // no dots allowed - bad("{'x.y':1}"); - bad("{'x\\.y':1}"); - // Check for $ bad("{x:{'$a':2}}"); good("{'a$b':2}"); @@ -2072,7 +2068,6 @@ public: // Queries are not ok bad("{num: {$gt: 1}}"); - bad("{_id: {$regex:'test'}}"); bad("{$gt: 2}"); bad("{a : { oo: [ {$bad:1}, {good:1}] }}"); good("{a : { oo: [ {'\\\\$good':1}, {good:1}] }}"); @@ -2127,28 +2122,6 @@ public: << 1 << "$hater" << 1))); - bad(BSON("a" << BSON("$ref" - << "coll" - << "$id" - << 1 - << "dot.dot" - << 1))); - - // _id isn't a RegEx, or Array - good("{_id: 0}"); - good("{_id: {a:1, b:1}}"); - good("{_id: {rx: /a/}}"); - good("{_id: {rx: {$regex: 'a'}}}"); - bad("{_id: /a/ }"); - bad("{_id: /a/, other:1}"); - bad("{hi:1, _id: /a/ }"); - bad("{_id: /a/i }"); - bad("{first:/f/i, _id: /a/i }"); - // Not really a regex type - bad("{_id: {$regex: 'a'} }"); - bad("{_id: {$regex: 'a', $options:'i'} }"); - bad("{_id: [1,2]}"); - bad("{_id: [1]}"); } }; |