} else {
                if (!update.$pull) {
                    update.$pull = {};
                }
                if (Array.isArray(value)) {