$postData = json_decode(file_get_contents("php://input"), true); $conn = new MongoClient(); $db = $conn->selectDB('employees'); $collection = new MongoCollection($db, 'employees'); $emp = array('id' => new MongoID($postData['$id']), true); try { $collection->remove($emp, array('justOne' => true)); } catch (MongoCursorException $e) { die(json_encode(array('message' => $e->getMessage()))); } echo ('The employee has been deleted successfully'); }
remove
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)