async loadMappings(
    fixtures = {},
    options = {
      indexCacheOnly: false,
      propagate: true,
      rawMappings: false,
      refresh: false,
    },
  ) {
    if (!isPlainObject(fixtures)) {
      throw kerror.get("api", "assert", "invalid_argument", fixtures, "object");
    }

    const mutex = new Mutex("loadMappings", { timeout: -1, ttl: 60000 });

    await mutex.lock();

    try {
      for (const index of Object.keys(fixtures)) {
        if (!isPlainObject(fixtures[index])) {
          throw kerror.get(
            "api",
            "assert",
            "invalid_argument",
            fixtures[index],
            "object",
          );
        }

        for (const [collection, mappings] of Object.entries(fixtures[index])) {
          try {
            await this.createIndex(index, {
              indexCacheOnly: options.indexCacheOnly,
              propagate: options.propagate,
            });
          } catch (error) {
            // @cluster: ignore if the index already exists to prevent race
            // conditions with index cache propagation
            if (error.id !== "services.storage.index_already_exists") {
              throw error;
            }
          }

          await this.createCollection(
            index,
            collection,
            options.rawMappings ? { mappings } : mappings,
            {
              indexCacheOnly: options.indexCacheOnly,
              propagate: options.propagate,
            },
          );

          if (options.refresh && !options.indexCacheOnly) {
            await this.client.refreshCollection(index, collection);
          }
        }
      }
    } finally {
      await mutex.unlock();
    }
  }
Load database mappings into Kuzzle

@param {String} mappings
@param {String} options rawMappings (false)
- propagate (true): notify the other nodes of the cluster
- indexCacheOnly (false): only update the cache, don't update the database
@returns {Promise}