summaryrefslogtreecommitdiff
path: root/jstests/in5.js
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-07-06 12:37:51 -0400
committerEliot Horowitz <eliot@10gen.com>2010-07-06 12:37:51 -0400
commitc616beb8e25a27fccbe04d89703e7f9a41e97cf4 (patch)
tree84751905bee04ceb48aac2a5a9d2636f08b3ac77 /jstests/in5.js
parentb0422a3a65227bc96ed6a597093cdfa40ecb0336 (diff)
downloadmongo-c616beb8e25a27fccbe04d89703e7f9a41e97cf4.tar.gz
test for SERVEr-1366
Diffstat (limited to 'jstests/in5.js')
-rw-r--r--jstests/in5.js55
1 files changed, 55 insertions, 0 deletions
diff --git a/jstests/in5.js b/jstests/in5.js
new file mode 100644
index 00000000000..02d95a5a66e
--- /dev/null
+++ b/jstests/in5.js
@@ -0,0 +1,55 @@
+
+t = db.in5
+
+function go( fn ){
+ t.drop();
+ o = {};
+ o[fn] = { a : 1 , b : 2 };
+ t.insert( o );
+
+ x = {};
+ x[fn] = { a : 1 , b : 2 };
+ assert.eq( 1 , t.find( x ).itcount() , "A1 - " + fn );
+
+
+ y = {};
+ y[fn] = { $in : [ { a : 1 , b : 2 } ] }
+ assert.eq( 1 , t.find( y ).itcount() , "A2 - " + fn );
+
+
+ z = {};
+ z[fn] = { a : 1 , b : { $in : [ 2 ] } }
+ //assert.eq( 1 , t.find( z ).itcount() , "A3 - " + fn ); // SERVER-1366
+
+
+ i = {}
+ i[fn] = 1
+ t.ensureIndex( i )
+
+ assert.eq( 1 , t.find( x ).itcount() , "B1 - " + fn );
+ assert.eq( 1 , t.find( y ).itcount() , "B2 - " + fn );
+ //assert.eq( 1 , t.find( z ).itcount() , "B3 - " + fn ); // SERVER-1366
+
+ t.dropIndex( i )
+
+ assert.eq( 1 , t.getIndexes().length , "T2" );
+
+ i = {}
+ i[fn + ".a" ] = 1;
+ t.ensureIndex( i )
+ assert.eq( 2 , t.getIndexes().length , "T3" );
+
+ assert.eq( 1 , t.find( x ).itcount() , "C1 - " + fn );
+ assert.eq( 1 , t.find( y ).itcount() , "C2 - " + fn );
+ //assert.eq( 1 , t.find( z ).itcount() , "C3 - " + fn ); // SERVER-1366
+
+ t.dropIndex( i )
+
+
+}
+
+go( "x" );
+go( "_id" )
+
+
+