Inserts or updates many records at once

@param array $collection
@param array $fillable Optional fillable protection
@throws \LogicException if failed on keys existence validation
@return boolean
778985
final public function persistMany(array $collection, array $fillable = array())
    {
        foreach ($collection as $item) {
            $this->persist($item, $fillable);
        }

        return true;
    }
72921
public function addManyFillable(array $fillable): Repository
	{
		foreach ($fillable as $allowed_field) {
			$this->addFillable($allowed_field);
		}

		return $this;
	}
724658
public void insertDocIntoMongoDBCollection(String collection, String document) {

        DBObject dbObject = (DBObject) JSON.parse(document);
        this.dataBase.getCollection(collection).insert(dbObject);

    }
1194219
protected function createMissingAssignRecords(Collection $records, Collection $existing)
    {
        $existing = $existing->keyBy(function ($record) {
            return $this->getAttachRecordHash((array) $record);
        });

        $records = $records->reject(function ($record) use ($existing) {
            return $existing->has($this->getAttachRecordHash($record));
        });

        $this->newPivotTableQuery()->insert($records->all());
    }
1149768
public static function keysExist(array $collection, array $keys)
    {
        $collection = array_flip($collection);

        foreach ($keys as $key) {
            if (!in_array($key, $collection)) {
                return false;
            }
        }

        return true;
    }
704574
public function removeManyFillable(array $fillable): Repository
	{
		foreach ($fillable as $disallowed_field) {
			$this->removeFillable($disallowed_field);
		}

		return $this;
	}
74071
public function addCollection(RequirementCollection $collection)
    {
        $this->requirements = array_merge($this->requirements, $collection->all());
    }
1364395
public function add(array $collection)
    {
        foreach ($collection as $data) {
            $breadcrumb = new Breadcrumb();
            $breadcrumb->setName($data['name'])
                       ->setLink(isset($data['link']) ? $data['link'] : '#');

            array_push($this->collection, $breadcrumb);
        }

        return $this;
    }
160331
public function load($collection)
    {
        $collectionId = $this->getCollectionId($collection);

        if ($this->isValidCollectionId($collectionId)) {
            throw new ClientException('Cannot alter a collection without a collection id');
        }

        $result = $this->getConnection()->put(
            UrlHelper::buildUrl(Urls::URL_COLLECTION, [$collectionId, self::OPTION_LOAD]),
            ''
        );

        return $result;
    }
290038
public function addManyToManyCollections($collections)
    {
        if (!is_array($collections)) {
            $collections = [$collections];
        }
        $this->manyToManyCollections = array_merge($this->manyToManyCollections, $collections);

        return $this;
    }
934407
public function match(RecordCollection $collection, RecordCollection $recordsLoaded)
    {
        $dictionary = $this->buildDictionary($recordsLoaded);

        foreach ($collection as $record) {
            /** @var Record $record */
            $results = $this->getResultsFromCollectionDictionary($dictionary, $collection, $record);
            /** @noinspection PhpUnhandledExceptionInspection */
            $record->getRelation($this->getName())->setResults($results);
        }

        return $recordsLoaded;
    }
1320431
public function setAll($collection) {
		foreach ($collection as $key => $element) {
			$this->set($key, $element);
		}
		
		return $this;
	}
42536
public function createCollection($collection, $options = [])
    {
        if (is_array($collection)) {
            list($database, $collectionName) = $collection;
        } else {
            $database = null;
            $collectionName = $collection;
        }
        $this->beginProfile($token = "    > create collection " . $this->composeCollectionLogName($collection) . " ...");
        $this->db->getDatabase($database)->createCollection($collectionName, $options);
        $this->endProfile($token);
    }
79449
public function haveInCollection($collection, array $data)
    {
        $collection = $this->driver->getDbh()->selectCollection($collection);
        if ($this->driver->isLegacy()) {
            $collection->insert($data);
            return $data['_id'];
        }

        $response = $collection->insertOne($data);
        return (string) $response->getInsertedId();
    }
897133
public static function get($property, $collection)
    {
        if (false === self::isValid($collection)) {
            return [];
        }

        $getter = sprintf('get%s', ucfirst($property));
        $result = [];
        foreach ($collection as $entity) {
            $function = [
                $entity,
                $getter
            ];

            if (false === is_callable($function)) {
                throw new LogicException('Missing getter');
            }

            $result[] = $entity->$getter();
        }

        return $result;
    }
348822
public function insertBatch(array $items, string $idField = 'id')
    {
        $collectionData = $this->storage->load(true);
        if (!isset($collectionData['items'])) {
            $collectionData['items'] = [];
        }
        if (!isset($collectionData['inc'])) {
            $collectionData['inc'] = 1;
        }
        foreach ($items as &$item) {
            $item[$idField] = $collectionData['inc']++;
        }
        unset($item);
        $collectionData['items'] = \array_merge($collectionData['items'], $items);
        $this->storage->save($collectionData);
    }
1184170
public function setMany(array $collection)
    {
        foreach ($collection as $key => $value) {
            $this->set($key, $value);
        }

        return $this;
    }