driver-legacy/src/main/com/mongodb/DB.java
public DBCollection createCollection(final String collectionName, @Nullable final DBObject options) {
        if (options != null) {
            try {
                executor.execute(getCreateCollectionOperation(collectionName, options), getReadConcern());
            } catch (MongoWriteConcernException e) {
                throw createWriteConcernException(e);
            }
        }
        return getCollection(collectionName);
    }
public DBCollection createCollection(final String collectionName, @Nullable final DBObject options) {
        if (options != null) {
            try {
                executor.execute(getCreateCollectionOperation(collectionName, options), getReadConcern());
            } catch (MongoWriteConcernException e) {
                throw createWriteConcernException(e);
            }
        }
        return getCollection(collectionName);
    }
public DBCollection createCollection ( final String collectionName , @ Nullable final DBObject options ) { if ( options != null ) { try { executor . execute ( getCreateCollectionOperation ( collectionName , options ) , getReadConcern ( ) ) ; } catch ( MongoWriteConcernException e ) { throw createWriteConcernException ( e ) ; } } return getCollection ( collectionName ) ; }
<p>Creates a collection with a given name and options. If the collection already exists,
this throws a {@code CommandFailureException}.</p>

<p>Possible options:</p>
<ul>
<li> <b>capped</b> ({@code boolean}) - Enables a collection cap. False by default. If enabled,
you must specify a size parameter. </li>
<li> <b>size</b> ({@code int}) - If capped is true, size specifies a maximum size in bytes for the capped collection. When
capped is false, you may use size to preallocate space. </li>
<li> <b>max</b> ({@code int}) -   Optional. Specifies a maximum "cap" in number of documents for capped collections. You must
also specify size when specifying max. </li>
</ul>
<p>Note that if the {@code options} parameter is {@code null}, the creation will be deferred to when the collection is written
to.</p>

@param collectionName the name of the collection to return
@param options        options
@return the collection
@throws MongoCommandException if the server is unable to create the collection
@throws WriteConcernException if the {@code WriteConcern} specified on this {@code DB} could not be satisfied
@throws MongoException for all other failures
@mongodb.driver.manual reference/method/db.createCollection/ createCollection()
<p > Creates a collection with a given name and options . If the collection already exists this throws a { @code CommandFailureException } . < / p >