mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
20 lines
776 B
JavaScript
20 lines
776 B
JavaScript
// contributed by Andrew Kempe
|
|
t = db.regex6;
|
|
t.drop();
|
|
|
|
t.save( { name : "eliot" } );
|
|
t.save( { name : "emily" } );
|
|
t.save( { name : "bob" } );
|
|
t.save( { name : "aaron" } );
|
|
|
|
t.ensureIndex( { name : 1 } );
|
|
|
|
assert.eq( 0 , t.find( { name : /^\// } ).count() , "index count" );
|
|
assert.eq( 0 , t.find( { name : /^\// } ).explain().nscanned , "index explain" );
|
|
assert.eq( 0 , t.find( { name : /^é/ } ).explain().nscanned , "index explain" );
|
|
assert.eq( 0 , t.find( { name : /^\é/ } ).explain().nscanned , "index explain" );
|
|
assert.eq( 0 , t.find( { name : /^\./ } ).explain().nscanned , "index explain" );
|
|
assert.eq( 4 , t.find( { name : /^./ } ).explain().nscanned , "index explain" );
|
|
|
|
assert.eq( 4 , t.find( { name : /^\Qblah\E/ } ).explain().nscanned , "index explain" );
|