Remove all indexes from a collection.

@param	string	$collection		the collection name
@usage	$mongodb->remove_all_index($collection);
356571
public function remove_all_indexes($collection = '')
	{
		if (empty($collection))
		{
			throw new \Mongo_DbException("No Mongo collection specified to remove all indexes from");
		}
		$this->db->{$collection}->deleteIndexes();
		$this->_clear();
		return $this;
	}
1074562
public function removeIndex($index)
    {
        if ($this->hasIndex($index)) {
            unset($this->_items[$index]);
            $this->_iterator = null;
            return true;
        }
        return false;
    }
197564
public function forget($collection)
    {
        $collection = $this->getCollectionNameFromInstance($collection);

        if ($this->has($collection))
        {
            $this->dirty = true;

            unset($this->entries[$collection]);
        }
    }
53317
protected function collection_query( &$collection ) 
	{
		$local_keys = array();
		
		foreach( $collection as $item )
		{
			$local_keys[] = $item->raw( $this->local_key );
		}
		
		// set the correct collection where
		$this->query->wheres = array();
		$this->query->where( $this->foreign_key, 'in', $local_keys );
		$this->query->group_result( $this->foreign_key );
		
		$this->query->limit( null );
	}
1372194
public function remove($record)
    {
        $params['index'] = $this->getName();
        $params['type'] = $record['type'];
        $params['id'] = $record['id'];

        self::getClient()->delete($params);
    }
20632
public function clear(): CollectionInterface
    {
        foreach ($this->indexes as $index) {
            $index->clear();
        }

        return parent::clear();
    }
653065
public static function byRemoving(Collection $collection, int $index): NotAllowed
    {
        return new static(sprintf(
            'Cannot alter the immutable collection `%s`. ' .
            '(Tried to unset position %d).',
            get_class($collection),
            $index
        ));
    }
348876
private static void removeDifferingIndexIfAny(final MongoCollection collection, final Index index) {
        val indexes = (ListIndexesIterable<Document>) collection.listIndexes();
        var indexExistsWithDifferentOptions = false;

        for (val existingIndex : indexes) {
            val keyMatches = existingIndex.get("key").equals(index.getIndexKeys());
            val optionsMatch = index.getIndexOptions().entrySet().stream().allMatch(entry -> entry.getValue().equals(existingIndex.get(entry.getKey())));
            val noExtraOptions = existingIndex.keySet().stream().allMatch(key -> MONGO_INDEX_KEYS.contains(key) || index.getIndexOptions().keySet().contains(key));
            indexExistsWithDifferentOptions |= keyMatches && !(optionsMatch && noExtraOptions);
        }

        if (indexExistsWithDifferentOptions) {
            LOGGER.debug("Removing MongoDb index [{}] from [{}] because it appears to already exist in a different form", index.getIndexKeys(), collection.getNamespace());
            collection.dropIndex(index.getIndexKeys());
        }
    }
576333
private function forgetCollection(Collection $collection)
    {
        $query_builder = $this->manager->createQueryBuilder();
        $query_builder
            ->delete(StackUsageRecord::class, 'r')
            ->where('r.collection_id = :collection_id')
            ->setParameter('collection_id', $collection->getCollectionID())
            ->getQuery()->execute();
    }
1114613
public function remove($documents)
    {
        if (!is_array($documents)) {
            $documents = array($documents);
        }

        $remove =& $this->getArchive()->getByRef('remove', array());
        foreach ($documents as $document) {
            $remove[] = $document;
        }
    }
841032
public function renumberCollection(Collection $collection)
    {
        $i = 0;

        foreach ( $collection as $item ) {
            if ( $item instanceof NumericallySortableContract ) {
                $item->updateSortingOrder(++$i);
            }
        }

        return $this;
    }
1164063
@Override
	public boolean removeAll(Collection<?> collection) {
		if (booleanTerms == null) {
			return false;
		}
		return booleanTerms.removeAll(collection);
	}
353570
public function delete($key)
    {
        if ($this->has($key)) {
            unset($this->collection[$key]);
            return true;
        }
        return false;
    }
357571
public function deleteID($ID)
    {
        if($this->offsetExists($this->safeOffset($ID))) {
            $this->offsetUnset($this->safeOffset($ID));
        } else {
            throw new CollectionIDNotFoundException('ID "' . $ID . '" does not exist in collection');
        }
    }
652437
public function removeKey($collection, $key) {
        return $this->driver->remove($collection, ['key' => (is_array($key) ? ['$in' => $key] : $key)]);
    }
409367
public function dropIndex($collection, $columns)
    {
        $this->beginProfile($token = "    > drop index on " . $this->composeCollectionLogName($collection) . " (" . Json::encode((array) $columns) . ") ...");
        $this->db->getCollection($collection)->dropIndex($columns);
        $this->endProfile($token);
    }
568847
public void dropAllDataMongoDBCollection(String collectionName) {
        DBCollection db = getMongoDBCollection(collectionName);
        DBCursor objectsList = db.find();
        try {
            while (objectsList.hasNext()) {
                db.remove(objectsList.next());
            }
        } finally {
            objectsList.close();
        }
    }