code: @Override
      protected void create(List<TableInfo> tableInfos)
      {
          try
          {
              HttpResponse response = null;
              createDatabaseIfNotExist(true);
              for (TableInfo tableInfo : tableInfos)
              {
                  CouchDBDesignDocument designDocument = new CouchDBDesignDocument();
                  Map<String, MapReduce> views = new HashMap<String, CouchDBDesignDocument.MapReduce>();
                  designDocument.setLanguage(CouchDBConstants.LANGUAGE);
                  String id = CouchDBConstants.DESIGN + tableInfo.getTableName();
                  for (IndexInfo indexInfo : tableInfo.getColumnsToBeIndexed())
                  {
                      createView(views, indexInfo.getColumnName());
                  }
  
                  // for id column.
                  createView(views, tableInfo.getIdColumnName());
  
                  // for select all.
                  createViewForSelectAll(tableInfo, views);
  
                  // for selecting specific field
                  createViewForSelectSpecificFields(views);
  
                  designDocument.setViews(views);
                  URI uri = new URI(CouchDBConstants.PROTOCOL, null, httpHost.getHostName(), httpHost.getPort(),
                          CouchDBConstants.URL_SEPARATOR + databaseName.toLowerCase() + CouchDBConstants.URL_SEPARATOR
                                  + id, null, null);
                  HttpPut put = new HttpPut(uri);
  
                  String jsonObject = gson.toJson(designDocument);
                  StringEntity entity = new StringEntity(jsonObject);
                  put.setEntity(entity);
                  try
                  {
                      response = httpClient.execute(httpHost, put, CouchDBUtils.getContext(httpHost));
                  }
                  finally
                  {
                      CouchDBUtils.closeContent(response);
                  }
              }
              // creating views for various aggregations in the following
              // order:
              // -- COUNT SUM MAX MIN AVG
              // IMPORTANT: The aggregations does not support WHERE clause
              createDesignDocForAggregations();
  
          }
          catch (Exception e)
          {
              logger.error("Error while creating database {} , caused by {}.", databaseName, e);
              throw new SchemaGenerationException("Error while creating database", e, "couchDB");
          }
      }
docs: Create database and design document.
  
  @param tableInfos
  the table infos