summaryrefslogtreecommitdiff
path: root/jstests/core
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2015-07-23 18:57:46 -0400
committerDavid Storch <david.storch@10gen.com>2015-07-23 19:51:04 -0400
commitffdb57ed20b4c359aefb85c4a4d9a235b9ceab25 (patch)
treeca33ec001e4f46e483032e07213565a3e6bab1f6 /jstests/core
parent455aa3de2fe23454b8acd2a6d4ae575f2bb1aa74 (diff)
downloadmongo-ffdb57ed20b4c359aefb85c4a4d9a235b9ceab25.tar.gz
SERVER-17544 remove $-prefixed find options from jstests and comments
Since the format for passing these options is different for the find command, these options should be specified using the DBQuery helpers.
Diffstat (limited to 'jstests/core')
-rw-r--r--jstests/core/find1.js7
-rw-r--r--jstests/core/finda.js2
-rw-r--r--jstests/core/idhack.js8
-rw-r--r--jstests/core/index_arr1.js6
-rw-r--r--jstests/core/index_diag.js24
-rw-r--r--jstests/core/maxscan.js8
-rw-r--r--jstests/core/minmax_edge.js2
-rw-r--r--jstests/core/query1.js8
-rw-r--r--jstests/core/show_record_id.js6
9 files changed, 27 insertions, 44 deletions
diff --git a/jstests/core/find1.js b/jstests/core/find1.js
index ed79c3dd2c7..1ad998062a4 100644
--- a/jstests/core/find1.js
+++ b/jstests/core/find1.js
@@ -21,13 +21,12 @@ if ( lookAtDocumentMetrics ) {
t.save( { a : 1 , b : "hi" } );
t.save( { a : 2 , b : "hi" } );
-/* very basic test of $snapshot just that we get some result */
-// we are assumign here that snapshot uses the id index; maybe one day it doesn't if so this would need to change then
-assert( t.find({$query:{},$snapshot:1})[0].a == 1 , "$snapshot simple test 1" );
+// Basic test of .snapshot().
+assert( t.find().snapshot()[0].a == 1 , ".snapshot() simple test 1" );
var q = t.findOne();
q.c = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz";
t.save(q); // will move a:1 object to after a:2 in the file
-assert( t.find({$query:{},$snapshot:1})[0].a == 1 , "$snapshot simple test 2" );
+assert( t.find().snapshot()[0].a == 1 , ".snapshot() simple test 2" );
assert( t.findOne( { a : 1 } ).b != null , "A" );
assert( t.findOne( { a : 1 } , { a : 1 } ).b == null , "B");
diff --git a/jstests/core/finda.js b/jstests/core/finda.js
index cf717d5b929..05d87c40972 100644
--- a/jstests/core/finda.js
+++ b/jstests/core/finda.js
@@ -41,7 +41,7 @@ function makeCursor( query, projection, sort, batchSize, returnKey ) {
print("bs: " + batchSize);
}
if ( returnKey ) {
- cursor._addSpecial( "$returnKey", true );
+ cursor.returnKey();
}
return cursor;
}
diff --git a/jstests/core/idhack.js b/jstests/core/idhack.js
index fa9ed5287c6..1b24fb933f6 100644
--- a/jstests/core/idhack.js
+++ b/jstests/core/idhack.js
@@ -75,8 +75,8 @@ assert.eq( { _id: 1 }, t.find( { _id: 1 }, { "foo.bar": 1 } ).next() );
assert.eq( { _id: 1, b: [ { c: 4 } ] },
t.find( { _id: 1 }, { b: { $elemMatch: { c: 4 } } } ).next() );
-// Non-simple: $returnKey.
-assert.eq( { _id: 1 }, t.find( { _id: 1 } )._addSpecial( "$returnKey", true ).next() );
+// Non-simple: .returnKey().
+assert.eq( { _id: 1 }, t.find( { _id: 1 } ).returnKey().next() );
-// Non-simple: $returnKey overrides other projections.
-assert.eq( { _id: 1 }, t.find( { _id: 1 }, { a: 1 } )._addSpecial( "$returnKey", true ).next() );
+// Non-simple: .returnKey() overrides other projections.
+assert.eq( { _id: 1 }, t.find( { _id: 1 }, { a: 1 } ).returnKey().next() );
diff --git a/jstests/core/index_arr1.js b/jstests/core/index_arr1.js
index d35cb80a83f..815c01ec0d3 100644
--- a/jstests/core/index_arr1.js
+++ b/jstests/core/index_arr1.js
@@ -1,4 +1,3 @@
-
t = db.index_arr1
t.drop()
@@ -10,14 +9,9 @@ assert.eq( 3 , t.find( { a : 5 } ).itcount() , "A1" )
t.ensureIndex( { a : 1 , "b.x" : 1 } )
-//t.find().sort( { a : 1 } )._addSpecial( "$returnKey" , 1 ).forEach( printjson )
-//t.find( { a : 5 } ).forEach( printjson )
-
assert.eq( 3 , t.find( { a : 5 } ).itcount() , "A2" ); // SERVER-1082
-
assert.eq( 2 , t.getIndexes().length , "B1" )
t.insert( { _id : 4 , a : 5 , b : [] } )
t.ensureIndex( { a : 1 , "b.a" : 1 , "b.c" : 1 } )
assert.eq( 3 , t.getIndexes().length , "B2" )
-
diff --git a/jstests/core/index_diag.js b/jstests/core/index_diag.js
index 21840682e7f..3651211009d 100644
--- a/jstests/core/index_diag.js
+++ b/jstests/core/index_diag.js
@@ -29,22 +29,16 @@ assert.eq( r( all ) , t.find().sort( { _id : -1 } ).toArray() , "A2" );
assert.eq( all , t.find().sort( { x : -1 } ).toArray() , "A3" );
assert.eq( r( all ) , t.find().sort( { x : 1 } ).toArray() , "A4" );
-assert.eq( ids , t.find().sort( { _id : 1 } )._addSpecial( "$returnKey" , true ).toArray() , "B1" )
-assert.eq( r( ids ) , t.find().sort( { _id : -1 } )._addSpecial( "$returnKey" , true ).toArray() , "B2" )
-assert.eq( xs , t.find().sort( { x : -1 } )._addSpecial( "$returnKey" , true ).toArray() , "B3" )
-assert.eq( r( xs ) , t.find().sort( { x : 1 } )._addSpecial( "$returnKey" , true ).toArray() , "B4" )
+assert.eq( ids , t.find().sort( { _id : 1 } ).returnKey().toArray() , "B1" )
+assert.eq( r( ids ) , t.find().sort( { _id : -1 } ).returnKey().toArray() , "B2" )
+assert.eq( xs , t.find().sort( { x : -1 } ).returnKey().toArray() , "B3" )
+assert.eq( r( xs ) , t.find().sort( { x : 1 } ).returnKey().toArray() , "B4" )
-assert.eq( r( xs ) , t.find().hint( { x : 1 } )._addSpecial( "$returnKey" , true ).toArray() , "B4" )
+assert.eq( r( xs ) , t.find().hint( { x : 1 } ).returnKey().toArray() , "B4" )
// SERVER-4981
t.ensureIndex( { _id : 1 , x : 1 } );
-assert.eq( all ,
- t.find().hint( { _id : 1 , x : 1 } )._addSpecial( "$returnKey" , true ).toArray()
- )
-assert.eq( r( all ) ,
- t.find().hint( { _id : 1 , x : 1 } ).sort( { x : 1 } )
- ._addSpecial( "$returnKey" , true ).toArray()
- )
-
-assert.eq( [ {} , {} , {} ],
- t.find().hint( { $natural : 1 } )._addSpecial( "$returnKey" , true ).toArray() )
+assert.eq( all , t.find().hint( { _id : 1 , x : 1 } ).returnKey().toArray() )
+assert.eq( r( all ) , t.find().hint( { _id : 1 , x : 1 } ).sort( { x : 1 } ).returnKey().toArray() )
+
+assert.eq( [ {} , {} , {} ], t.find().hint( { $natural : 1 } ).returnKey().toArray() )
diff --git a/jstests/core/maxscan.js b/jstests/core/maxscan.js
index 3d15b26f638..0c7e97488cf 100644
--- a/jstests/core/maxscan.js
+++ b/jstests/core/maxscan.js
@@ -8,11 +8,11 @@ for ( i=0; i<N; i++ ){
}
assert.eq( N , t.find().itcount() , "A" )
-assert.eq( 50 , t.find()._addSpecial( "$maxScan" , 50 ).itcount() , "B" )
+assert.eq( 50 , t.find().maxScan(50).itcount() , "B" )
assert.eq( 10 , t.find( { x : 2 } ).itcount() , "C" )
-assert.eq( 5 , t.find( { x : 2 } )._addSpecial( "$maxScan" , 50 ).itcount() , "D" )
+assert.eq( 5 , t.find( { x : 2 } ).maxScan(50).itcount() , "D" )
t.ensureIndex({x: 1});
-assert.eq( 10, t.find( { x : 2 } ).hint({x:1})._addSpecial( "$maxScan" , N ).itcount() , "E" )
-assert.eq( 0, t.find( { x : 2 } ).hint({x:1})._addSpecial( "$maxScan" , 1 ).itcount() , "E" )
+assert.eq( 10, t.find( { x : 2 } ).hint({x:1}).maxScan(N).itcount() , "E" )
+assert.eq( 0, t.find( { x : 2 } ).hint({x:1}).maxScan(1).itcount() , "E" )
diff --git a/jstests/core/minmax_edge.js b/jstests/core/minmax_edge.js
index a34cafe8c20..a22367cc2a9 100644
--- a/jstests/core/minmax_edge.js
+++ b/jstests/core/minmax_edge.js
@@ -1,5 +1,5 @@
/*
- * Test that $min and $max queries properly handle the edge cases with NaN and Infinity.
+ * Test that .min() and .max() queries properly handle the edge cases with NaN and Infinity.
* Other edge cases are covered by C++ unit tests.
*/
diff --git a/jstests/core/query1.js b/jstests/core/query1.js
index 8fa402cda65..1f39380cbf5 100644
--- a/jstests/core/query1.js
+++ b/jstests/core/query1.js
@@ -19,8 +19,8 @@ t.find().forEach(
assert.eq( num , 3 , "num" )
assert.eq( total , 8 , "total" )
-assert.eq( 3 , t.find()._addSpecial( "$comment" , "this is a test" ).itcount() , "B1" )
-assert.eq( 3 , t.find()._addSpecial( "$comment" , "this is a test" ).count() , "B2" )
+assert.eq( 3 , t.find().comment("this is a test").itcount() , "B1" )
+assert.eq( 3 , t.find().comment("this is a test").count() , "B2" )
-assert.eq( 3 , t.find( { "$comment" : "yo ho ho" } ).itcount() , "C1" )
-assert.eq( 3 , t.find( { "$comment" : "this is a test" } ).count() , "C2" )
+assert.eq( 3 , t.find().comment("yo ho ho").itcount() , "C1" )
+assert.eq( 3 , t.find().comment("this is a test").count() , "C2" )
diff --git a/jstests/core/show_record_id.js b/jstests/core/show_record_id.js
index d28cf6560e6..566bdfff9a9 100644
--- a/jstests/core/show_record_id.js
+++ b/jstests/core/show_record_id.js
@@ -12,23 +12,19 @@ function checkResults( arr ) {
// Check query.
t.save( {} );
-checkResults( t.find()._addSpecial("$showDiskLoc" , true).toArray() );
checkResults( t.find().showRecordId().toArray() );
// Check query and get more.
t.save( {} );
t.save( {} );
-checkResults( t.find().batchSize( 2 )._addSpecial("$showDiskLoc" , true).toArray() );
checkResults( t.find().batchSize( 2 ).showRecordId().toArray() );
// Check with a covered index.
t.ensureIndex( { a:1 } );
-checkResults
-( t.find( {}, { _id:0, a:1 } ).hint( { a:1 } )._addSpecial("$showDiskLoc" , true).toArray() );
+checkResults( t.find( {}, { _id:0, a:1 } ).hint( { a:1 } ).showRecordId().toArray() );
checkResults( t.find( {}, { _id:0, a:1 } ).hint( { a:1 } ).showRecordId().toArray() );
// Check with an idhack query.
t.drop();
t.save({_id: 0, a: 1});
-checkResults( t.find( { _id: 0 } )._addSpecial("$showDiskLoc", true).toArray() );
checkResults( t.find( { _id: 0 } ).showRecordId().toArray() );