Am looking for ways to print the statistics of the collection from my java program.
Hi Venkat,
You could utilise the runCommand() to retrieve collection stats, for example using MongoDB Java Driver v3.2:
MongoDatabase database = client.getDatabase("databaseName");
Document stats = database.runCommand(new Document("collStats", "collectionName"));
System.out.println(stats);
For more info see MongoDB Java Driver v3.2: running a command.
Regards,
Wan