summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2014-11-20 14:06:40 -0500
committerDavid Storch <david.storch@10gen.com>2014-11-20 14:06:40 -0500
commit903b0e905c80b4a2864cb5e05c11c5565b1f19f9 (patch)
tree7f528d48913f37b60607596ca5d0e61ad32f9ae5 /jstests
parent671e340cf5a6676fb4008103d3f0e2684354be8f (diff)
downloadmongo-903b0e905c80b4a2864cb5e05c11c5565b1f19f9.tar.gz
SERVER-14799 hint for a count allows hint to be specified as a document
Diffstat (limited to 'jstests')
-rw-r--r--jstests/core/count_hint.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/jstests/core/count_hint.js b/jstests/core/count_hint.js
index 93322d282db..f72c5d31deb 100644
--- a/jstests/core/count_hint.js
+++ b/jstests/core/count_hint.js
@@ -18,3 +18,9 @@ t.ensureIndex( { x:1 }, { sparse:true } );
assert.eq( 0, t.find( { i: 1 } ).hint( "x_1" ).count(), "C" );
assert.eq( 2, t.find().hint( "x_1" ).count(), "D" );
+
+// SERVER-14799: Should be able to pass the hint as a document (not only as a string).
+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(); } );