@@ -723,6 +723,7 @@ void testDropIndexes_twoIndexesWithTheSameKey() {
723723 );
724724 }
725725
726+ // https://github.com/bwaldvogel/mongo-java-server/issues/246
726727 @ Test
727728 void testDropIndexes_string_twoIndexesWithTheSameKey () {
728729 collection .insertOne (json ("_id: 1, c: 10" ));
@@ -759,6 +760,45 @@ void testDropIndexes_string_twoIndexesWithTheSameKey() {
759760 );
760761 }
761762
763+ // https://github.com/bwaldvogel/mongo-java-server/issues/247
764+ @ Test
765+ void testDropIndexes_all () {
766+ collection .insertOne (json ("_id: 1, c: 10, d:1" ));
767+
768+ MongoCollection <Document > otherCollection = getCollection ("other" );
769+ otherCollection .insertOne (json ("_id: 1, c: 10" ));
770+
771+ collection .createIndex (new Document ("c" , 1 ));
772+ collection .createIndex (new Document ("d" , 1 ));
773+ otherCollection .createIndex (new Document ("c" , 1 ));
774+
775+ assertThat (collection .listIndexes ())
776+ .containsExactlyInAnyOrder (
777+ json ("key: {_id: 1}" ).append ("name" , "_id_" ).append ("v" , 2 ),
778+ json ("key: {c: 1}" ).append ("name" , "c_1" ).append ("v" , 2 ),
779+ json ("key: {d: 1}" ).append ("name" , "d_1" ).append ("v" , 2 )
780+ );
781+
782+ assertThat (otherCollection .listIndexes ())
783+ .containsExactlyInAnyOrder (
784+ json ("key: {_id: 1}" ).append ("name" , "_id_" ).append ("v" , 2 ),
785+ json ("key: {c: 1}" ).append ("name" , "c_1" ).append ("v" , 2 )
786+ );
787+
788+ collection .dropIndex ("*" );
789+
790+ assertThat (collection .listIndexes ())
791+ .containsExactlyInAnyOrder (
792+ json ("key: {_id: 1}" ).append ("name" , "_id_" ).append ("v" , 2 )
793+ );
794+
795+ assertThat (otherCollection .listIndexes ())
796+ .containsExactlyInAnyOrder (
797+ json ("key: {_id: 1}" ).append ("name" , "_id_" ).append ("v" , 2 ),
798+ json ("key: {c: 1}" ).append ("name" , "c_1" ).append ("v" , 2 )
799+ );
800+ }
801+
762802 @ Test
763803 public void testCurrentOperations () {
764804 Document currentOperations = getAdminDb ().getCollection ("$cmd.sys.inprog" ).find ().first ();
0 commit comments