jolivier
jolivier

Reputation: 7635

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

Upvotes: 10

Views: 8269

Answers (1)

Brendan W. McAdams
Brendan W. McAdams

Reputation: 9477

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

This should work -

db.things.remove(MongoDBObject.empty)

Upvotes: 13

Related Questions