Search code examples
mongodbscalacasbah

Avoid to get "system.indexes" as a collection name in casbah


I'm using casbah to find collection names in a mongodb-database

    val mongoClient = MongoClient()
    val db = mongoClient("db_name")
    val coll = db.collectionNames()

It also gives 'system.indexes' because each mongo database has that one. Is there any way to get rid from this ?


Solution

  • You have to filter it by yourself.

    val coll = db.collectionNames().filterNot(_.startsWith("system."))