I want to delete all documents from a collection in java. Here is my code:
MongoClient client = new MongoClient("10.0.2.113" , 27017); MongoDatabase db = client.getDatabase("maindb"); db.getCollection("mainCollection").deleteMany(new Document());
Is this being done right?
I am using MongoDB 3.0.2
java mongodb mongodb-java
Viratan
source share