Search code examples
scalamongodbcasbah

How to clear/drop/empty a MongoDb collection with Casbah


I started using MongoDb in Scala via Casbah but cannot find on the Casbah documentation / google the way to drop the content of a collection. The MongoDd doc says the MongoDb shell command to do so is

db.things.remove({}); 

But how can we achieve the same via Casbah?

Thanks in advance,

Olivier


Solution

  • Casbah's equivalent to the shells {} empty document operator is `MongoDBObject.empty

    This should work -

    db.things.remove(MongoDBObject.empty)