0
저는 mongoDB의 초보자입니다. 적어도 30 초 후에 데이터베이스에서 각 메시지를 삭제하고 싶습니다.MongoDB PHP는 ensureIndex와 함께 TTL을 사용합니다.
이것은 내 코드입니다.
$mess = array(
"login" => $_SESSION['name'],
"message" => $_POST['msg'],
"expire" => true
);
$db->chat->insert($mess);
$collection = $db->chat;
$collection->ensureIndex(array('expire' => true), array('expireAfterSeconds' => 30));