mGetDocument #
Get multiple Documents according to the input document IDs.
mGetDocument(documentIds, [options], callback) #
Arguments | Type | Description |
---|---|---|
documentIds | String[] | Array of IDs of documents to retrieve |
options | JSON Object | Optional parameters |
callback | function | Callback handling the response |
Options #
Option | Type | Description | Default |
---|---|---|---|
queuable | boolean | Make this request queuable or not | true |
Callback Response #
Returns a JSON object
containing the raw Kuzzle response.
Usage #
// Using callbacks (NodeJS or Web Browser)
kuzzle
.collection('collection', 'index')
.mGetDocument(['doc1', 'doc2'], function (error, result) {
// callback called once the mGet operation has completed
// => the result is a JSON object containing the raw Kuzzle response
});
// Using promises (NodeJS only)
kuzzle
.collection('collection', 'index')
.mGetDocument()
.then(result => {
// promise resolved once the mGet operation has completed
// => the result is a JSON object containing the raw Kuzzle response
});
Callback response:
{
"hits": [
{ "_id": "doc1", "first": "document" },
{ "_id": "doc2", "second": "document" }
],
"total": 2
}
Edit this page on Github(opens new window)