Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Deleting Records

Mira Dytko edited this page Jan 20, 2022 · 5 revisions

Deleting Records

Use these Aerospike PHP client methods to delete record and bin data from the Aerospike database:

  • remove() — Remove the record at the specified key.

  • removeBin()— Remove specified bins from a record.

    • Remove one bin from a record:

$key = $db->initKey("infosphere", "characters", 3); $db->removeBin($key, ["Alma Mater"]);

- Remove a record completely:
```php
$key = $db->initKey("infosphere", "characters", 5);
$status = $db->remove($key);
if ($status == Aerospike::OK) {
  echo "Record removed.\n";
} elseif ($status == Aerospike::ERR_RECORD_NOT_FOUND) {
  echo "No such record in the database.\n";
} else {
  echo "Error [{$db->errorno()}]: ".$db->error();
}