Contoh Bulk Delete CouchDB
$tampil = tampil_data("mata_pelajaran");
foreach ($tampil as $item) {
$x["_id"] = $item["_id"];
$x["_rev"] = $item["_rev"];
$x["_deleted"] = true;
$data[] = $x;
}
// dd($data);
$json = json_encode($data);
// dd($json);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '' . server() . '/_bulk_docs',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => '{
"docs": ' . $json . '
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
dd($response);
Lanjut Part : 1
Muhammad Ullil Fahri
WA : 089696380422
Tautan WA : https://wa.me/message/SG4YA2XQP5FPE1