diff options
author | David Storch <david.storch@10gen.com> | 2015-01-26 15:08:43 -0500 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2015-02-05 16:05:44 -0500 |
commit | c59a144b57d07d7310dc23ad9cc78a1618f37237 (patch) | |
tree | 73f9be32501296a96b1d70d0c0ba6ebf26a852ad /jstests/core/count_hint.js | |
parent | 5145903fc270db94e6a4cbfd5c956026a107e079 (diff) | |
download | mongo-c59a144b57d07d7310dc23ad9cc78a1618f37237.tar.gz |
SERVER-14792 count with a bad hint should fail, even if there is no query predicate
Diffstat (limited to 'jstests/core/count_hint.js')
-rw-r--r-- | jstests/core/count_hint.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/jstests/core/count_hint.js b/jstests/core/count_hint.js index f72c5d31deb..1fa1c1d08e1 100644 --- a/jstests/core/count_hint.js +++ b/jstests/core/count_hint.js @@ -24,3 +24,8 @@ assert.eq( 0, t.find( { i: 1 } ).hint( { x: 1 } ).count(), "E" ); assert.eq( 2, t.find().hint( { x: 1 } ).count(), "F" ); assert.eq( 1, t.find( { i: 1 } ).hint( { _id: 1 } ).count(), "G" ); assert.throws( function() { t.find( { i: 1 } ).hint( { bad: 1, hint: 1 } ).count(); } ); + +// SERVER-14792: bad hints should cause the count to fail, even if there is no query predicate. +assert.eq( 2, t.find().hint( { i: 1 } ).count(), "H" ); +assert.throws( function() { t.find().hint( { bad: 1, hint: 1 } ).count() } ); +assert.throws( function() { t.find().hint( "BAD HINT" ).count() } ); |