public static boolean collectionExists ( MongoDatabase db , String collectionName ) { return db . listCollections ( ) . filter ( Filters . eq ( "name" , collectionName ) ) . first ( ) != null ; }
Check if a collection exists .