Collection::dropIndex

(사용 가능한 버전 정보가 없으며 Git에만 있을 수 있음)

Collection::dropIndex — 컬렉션 인덱스 삭제


설명

public mysql_xdevapi\Collection::dropIndex(string $index_name): bool

컬렉션 인덱스를 삭제합니다.

인덱스가 존재하지 않는 경우 이 작업은 오류를 생성하지 않지만, 이 경우 false가 반환됩니다.


매개변수

index_name
삭제할 컬렉션 인덱스의 이름입니다.

반환 값

DROP INDEX 작업이 성공하면 true이고, 그렇지 않으면 false입니다.


Examples

예제 #1 mysql_xdevapi\Collection::dropIndex() 예제

                  
<?php
$session = mysql_xdevapi\getSession("mysqlx://user:password@localhost");

$session->sql("DROP DATABASE IF EXISTS addressbook")->execute();
$session->sql("CREATE DATABASE addressbook")->execute();

$schema = $session->getSchema("addressbook");
$create = $schema->createCollection("people");

// ...

$collection = $schema->getCollection("people");

$collection->createIndex(
  'myindex',
  '{"fields": [{"field": "$.name", "type": "TEXT(25)", "required": true}], "unique": false}'
);

// ...

if ($collection->dropIndex('myindex')) {
    echo 'An index named 'myindex' was found, and dropped.';
}
?>
                  
                

위의 예는 다음을 출력합니다.

An index named 'myindex' was found, and dropped.