summaryrefslogtreecommitdiff
path: root/jstests/ne2.js
diff options
context:
space:
mode:
authorAntonin Kral <a.kral@bobek.cz>2011-03-17 00:05:43 +0100
committerAntonin Kral <a.kral@bobek.cz>2011-03-17 00:05:43 +0100
commit582fc32574a3b158c81e49cb00e6ae59205e66ba (patch)
treeac64a3243e0d2121709f685695247052858115c8 /jstests/ne2.js
parent2761bffa96595ac1698d86bbc2e95ebb0d4d6e93 (diff)
downloadmongodb-582fc32574a3b158c81e49cb00e6ae59205e66ba.tar.gz
Imported Upstream version 1.8.0
Diffstat (limited to 'jstests/ne2.js')
-rw-r--r--jstests/ne2.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/jstests/ne2.js b/jstests/ne2.js
new file mode 100644
index 0000000..89e99aa
--- /dev/null
+++ b/jstests/ne2.js
@@ -0,0 +1,21 @@
+// check that we don't scan $ne values
+
+t = db.jstests_ne2;
+t.drop();
+t.ensureIndex( {a:1} );
+
+t.save( { a:-0.5 } );
+t.save( { a:0 } );
+t.save( { a:0 } );
+t.save( { a:0.5 } );
+
+e = t.find( { a: { $ne: 0 } } ).explain( true );
+assert.eq( "BtreeCursor a_1 multi", e.cursor );
+assert.eq( 0, e.indexBounds.a[ 0 ][ 1 ] );
+assert.eq( 0, e.indexBounds.a[ 1 ][ 0 ] );
+assert.eq( 3, e.nscanned );
+
+e = t.find( { a: { $gt: -1, $lt: 1, $ne: 0 } } ).explain();
+assert.eq( "BtreeCursor a_1 multi", e.cursor );
+assert.eq( { a: [ [ -1, 0 ], [ 0, 1 ] ] }, e.indexBounds );
+assert.eq( 3, e.nscanned );