mDeleteDocument

// Using callbacks (NodeJS or Web Browser)
kuzzle
  .collection('collection', 'index')
  .mDeleteDocument(['doc1', 'doc2'], function (error, result) {
    // callback called once the mDelete operation has completed
    // => the result is a JSON object containing the raw Kuzzle response
  });

// Using promises (NodeJS only)
kuzzle
 .collection('collection', 'index')
 .mDeleteDocument()
 .then(result => {
   // promise resolved once the mDelete operation has completed
   // => the result is a JSON object containing the raw Kuzzle response
 });
String[] documentIds = new String[]{"doc1", "doc2"};

kuzzle
  .collection("collection", "index")
  .mDeleteDocument(documentIds, new ResponseListener<JSONObject>() {
    @Override
    public void onSuccess(JSONObject object) {
      // callback called once the mDelete operation has completed
      // => the result is a JSON object containing the raw Kuzzle response
    }

    @Override
    public void onError(JSONObject error) {
      // Handle error
    }
  });
<?php

use \Kuzzle\Kuzzle;

$kuzzle = new Kuzzle('localhost');
$dataCollection = $kuzzle->collection('collection', 'index');

try {
  $result = $dataCollection->mDeleteDocument(['doc1', 'doc2']);
}
catch (ErrorException $e) {

}

Callback response:

["doc1", "doc2"]

Delete multiple Documents according to the provided IDs.


mDeleteDocument(documentIds, [options], callback)

ArgumentsTypeDescription
documentIdsString[]Array of IDs of documents to delete
optionsJSON ObjectOptional parameters
callbackfunctionCallback handling the response

Options

OptionTypeDescriptionDefault
queuablebooleanMark this request as (not) queuabletrue

Callback response

Resolves to a JSON object containing the raw Kuzzle response. Can return a 206 partial error in case some documents could not be deleted.