title: How to delete all documents in mongodb collection in java
body: <p>I want to delete all documents in a collection in java. Here is my code: </p>
  
  <pre><code>MongoClient client = new MongoClient("10.0.2.113" , 27017);
          MongoDatabase db = client.getDatabase("maindb");
          db.getCollection("mainCollection").deleteMany(new Document());
  </code></pre>
  
  <p>Is this the correct way to do this?</p>
  
  <p>I am using MongoDB 3.0.2</p>