Web Analytics
 Contoh Bulk Delete CouchDB

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
Jam : 20:17:03
Durasi Part : 0:0:1
Durasi Total : 0:0:1

Punya Pertanyaan , Silahkan Whatsapp Langsung
Muhammad Ullil Fahri
WA : 089696380422
Tautan WA : https://wa.me/message/SG4YA2XQP5FPE1
Theme Customizer

Theme Styles