I want to create a capped collection from Java code. I found the syntax for creating it through JavaScript, but could not find an example for Java.
Mongo mongo =
With more recent java mongo driver (ie 3.4) the creation should slightly change:
CreateCollectionOptions opts = new CreateCollectionOptions().capped(true).sizeInBytes(1024*1024); database.createCollection("test", opts);
Please, notice that the createCollection is not returning any value.
createCollection