driver-legacy/src/main/com/mongodb/DB.java
public DBCollection createView(final String viewName, final String viewOn, final List<? extends DBObject> pipeline,
                                   final DBCreateViewOptions options) {
        try {
            notNull("options", options);
            DBCollection view = getCollection(viewName);
            executor.execute(new CreateViewOperation(name, viewName, viewOn, view.preparePipeline(pipeline), writeConcern)
                                     .collation(options.getCollation()), getReadConcern());
            return view;
        } catch (MongoWriteConcernException e) {
            throw createWriteConcernException(e);
        }
    }
public DBCollection createView(final String viewName, final String viewOn, final List<? extends DBObject> pipeline,
                                   final DBCreateViewOptions options) {
        try {
            notNull("options", options);
            DBCollection view = getCollection(viewName);
            executor.execute(new CreateViewOperation(name, viewName, viewOn, view.preparePipeline(pipeline), writeConcern)
                                     .collation(options.getCollation()), getReadConcern());
            return view;
        } catch (MongoWriteConcernException e) {
            throw createWriteConcernException(e);
        }
    }
Creates a view with the given name, backing collection/view name, aggregation pipeline, and options that defines the view.

@param viewName the name of the view to create
@param viewOn   the backing collection/view for the view
@param pipeline the pipeline that defines the view
@param options  the options for creating the view
@return the view as a DBCollection
@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
@since 3.4
@mongodb.server.release 3.4
@mongodb.driver.manual reference/command/create Create Command