public Set < String > getCollectionNames ( ) { List < String > collectionNames = new MongoIterableImpl < DBObject > ( null , executor , ReadConcern . DEFAULT , primary ( ) , mongo . getMongoClientOptions ( ) . getRetryReads ( ) ) { @ Override public ReadOperation < BatchCursor < DBObject > > asReadOperation ( ) { return new ListCollectionsOperation < DBObject > ( name , commandCodec ) . nameOnly ( true ) ; } } . map ( new Function < DBObject , String > ( ) { @ Override public String apply ( final DBObject result ) { return ( String ) result . get ( "name" ) ; } } ) . into ( new ArrayList < String > ( ) ) ; Collections . sort ( collectionNames ) ; return new LinkedHashSet < String > ( collectionNames ) ; }
Returns a set containing the names of all collections in this database .