code: public static MongoDatabase getOrInitDefaultDatabase(String connectionString, String database) {
          if (DEFAULT_DATABASE == null) {
              synchronized (LOCK) {
                  if (DEFAULT_DATABASE == null) {
                      if (!StringUtil.isEmpty(connectionString)) {
                          DEFAULT_CLIENT = MongoClients.create(connectionString);
                          CodecRegistry pojoCodecRegistry = fromRegistries(
                                  /*fromCodecs(new StringCodecExt()),*/
                                  MongoClientSettings.getDefaultCodecRegistry(),
                                  fromProviders(PojoCodecProvider.builder().automatic(true).build()));
                          DEFAULT_DATABASE = DEFAULT_CLIENT.getDatabase(database).withCodecRegistry(pojoCodecRegistry);
                      } else {
                          throw new RuntimeException("No datasource configuration found for mongodb.");
                      }
                  }
              }
          }
          return DEFAULT_DATABASE;
      }
docs: Get default mongodb database reference or initiate it if not initialized.
  
  @param connectionString MongoDB standard connection string
  @param database         mongodb database name
  @return MongoDB mongodb client database reference.