code: public static boolean deleteDatabase(final StitchAppClientInfo appInfo,
                                         final String serviceName,
                                         final EmbeddedMongoClientFactory clientFactory,
                                         final String userId) {
      final String dataDir = appInfo.getDataDirectory();
      if (dataDir == null) {
        throw new IllegalArgumentException("StitchAppClient not configured with a data directory");
      }
  
      final String instanceKey = String.format(
          "%s-%s_sync_%s_%s", appInfo.getClientAppId(), dataDir, serviceName, userId);
      final String dbPath = String.format(
          "%s/%s/sync_mongodb_%s/%s/0/", dataDir, appInfo.getClientAppId(), serviceName, userId);
      final MongoClient client =
          clientFactory.getClient(instanceKey, dbPath, appInfo.getCodecRegistry());
  
      for (final String listDatabaseName : client.listDatabaseNames()) {
        try {
          client.getDatabase(listDatabaseName).drop();
        } catch (Exception e) {
          // do nothing
        }
      }
  
      client.close();
      clientFactory.removeClient(instanceKey);
  
      return new File(dbPath).delete();
    }
docs: Delete a database for a given path and userId.
  @param appInfo the info for this application
  @param serviceName the name of the associated service
  @param clientFactory the associated factory that creates clients
  @param userId the id of the user's to delete
  @return true if successfully deleted, false if not