summaryrefslogtreecommitdiff
path: root/jstests/index_many.js
diff options
context:
space:
mode:
authorAntonin Kral <a.kral@bobek.cz>2010-01-31 08:32:52 +0100
committerAntonin Kral <a.kral@bobek.cz>2010-01-31 08:32:52 +0100
commit4eefaf421bfeddf040d96a3dafb12e09673423d7 (patch)
treecb2e5ccc7f98158894f977ff131949da36673591 /jstests/index_many.js
downloadmongodb-4eefaf421bfeddf040d96a3dafb12e09673423d7.tar.gz
Imported Upstream version 1.3.1
Diffstat (limited to 'jstests/index_many.js')
-rw-r--r--jstests/index_many.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/jstests/index_many.js b/jstests/index_many.js
new file mode 100644
index 0000000..9960afa
--- /dev/null
+++ b/jstests/index_many.js
@@ -0,0 +1,34 @@
+t = db.many;
+
+t.drop();
+db.many2.drop();
+
+t.save({x:9});
+t.save({x:19});
+
+x = 2;
+while( x < 60 ) {
+ patt={};
+ patt[x] = 1;
+ if( x == 20 )
+ patt = { x : 1 };
+ t.ensureIndex(patt);
+ x++;
+}
+
+// print( tojson(db.getLastErrorObj()) );
+assert( db.getLastError(), "should have an error 'too many indexes'" );
+
+// 40 is the limit currently
+
+// print( t.getIndexes().length == 40, "40" );
+
+assert( t.getIndexes().length == 40, "40" );
+
+assert( t.find({x:9}).length() == 1, "b" ) ;
+
+t.renameCollection( "many2" );
+
+assert( t.find({x:9}).length() == 0, "c" ) ;
+
+assert( db.many2.find({x:9}).length() == 1, "d" ) ;