summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2011-08-29 16:37:33 -0700
committerAaron <aaron@10gen.com>2011-08-29 16:37:39 -0700
commita406f1b8f4adba88b876417df5a8b081695c05a9 (patch)
tree6f16dc80c7caf3e644cba0b4f744fc3cc8309927
parentd43d01444dd6b2c707aa6e7a4d4fcbcb456b2686 (diff)
downloadmongo-a406f1b8f4adba88b876417df5a8b081695c05a9.tar.gz
SERVER-3717 test
-rw-r--r--jstests/numberlong2.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/jstests/numberlong2.js b/jstests/numberlong2.js
new file mode 100644
index 00000000000..966ab2d33dd
--- /dev/null
+++ b/jstests/numberlong2.js
@@ -0,0 +1,23 @@
+// Test precision of NumberLong values with v1 index code SERVER-3717
+
+if ( 0 ) { // SERVER-3717
+
+t = db.jstests_numberlong2;
+t.drop();
+
+t.ensureIndex( {x:1} );
+
+longNum = NumberLong("1123539983311657217");
+t.save({x:longNum});
+assert.eq( longNum, t.find().hint({x:1}).next().x );
+assert.eq( longNum, t.find( {}, {_id:0, x:1} ).hint({x:1}).next().x );
+
+t.remove();
+s = "11235399833116571";
+for( i = 99; i >= 0; --i ) {
+ t.save( {x:NumberLong( s + i )} );
+}
+
+assert.eq( t.find().sort( {x:1} ).hint( {$natural:1} ).toArray(), t.find().sort( {x:1} ).hint( {x:1} ).toArray() );
+
+} \ No newline at end of file