function importDocument(key, data) {

    const split = key.split(".");
    if ("json" === split[split.length - 1]) {
        split.pop();
    }
    const field = 2 < split.length ? split[0] : "",
          ref = 2 < split.length ? split[2] : split[1];


    if (this.worker && field) {
        return this.index.get(field).import(key);
    }

    if (!data) {
        return;
    }
    if ("string" == typeof data) {
        data = /** @type {Array<Object>} */JSON.parse( /** @type {string} */data);
    }

    if (!field) {

        switch (ref) {

            case "reg":

                this.fastupdate = !1;
                this.reg = json_to_reg( /** @type {Array<string|number>} */data, this.reg);

                for (let i = 0, idx; i < this.field.length; i++) {
                    idx = this.index.get(this.field[i]);
                    idx.fastupdate = !1;
                    idx.reg = this.reg;
                }

                if (this.worker) {
                    const promises = [],
                          self = this;


                    for (const index of this.index.values()) {

                        promises.push(index.import(key));
                    }

                    return Promise.all(promises);
                }

                break;

            case "tag":

                this.tag = json_to_ctx(data, this.tag);
                break;

            case "doc":

                this.store = json_to_map(data, this.store);
                break;

            case "cfg":

                break;

        }
    } else {

        return this.index.get(field).import(ref, data);
    }
}
@param {!string} key
@param {string|Array<Object>} data
@this {Document}