mUpdateDocument #
Update the provided Documents.
mUpdateDocument(documents, [options], [callback]) #
Arguments | Type | Description |
---|---|---|
documents | Document[] | Array of Documents to update |
options | JSON Object | Optional parameters |
callback | function | Optional callback |
Options #
Option | Type | Description | Default |
---|---|---|---|
queuable | boolean | Make this request queuable or not | true |
Return Value #
Returns the Collection
object to allow chaining.
Callback Response #
Returns a JSON object
containing the raw Kuzzle response. Can return a 206 partial error in cases where documents could not be updated.
Usage #
var
Document = require('./src/Document'),
firstDocument = new Document(collection, 'doc1', {title: 'foo', content: 'bar'}),
secondDocument = new Document(collection, 'doc2', {title: 'foo', content: 'bar'});
// Using callbacks (NodeJS or Web Browser)
kuzzle
.collection('collection', 'index')
.mUpdateDocument([firstDocument, secondDocument], function (error, result) {
// callback called once the mUpdate operation has completed
// => the result is a JSON object containing the raw Kuzzle response
});
// Using promises (NodeJS only)
kuzzle
.collection('collection', 'index')
.mUpdateDocument([firstDocument, secondDocument])
.then(result => {
// promise resolved once the mUpdate operation has completed
// => the result is a JSON object containing the raw Kuzzle response
});
Callback response:
{
"hits": [{ "first": "document" }, { "second": "document" }],
"total": 2
}
Edit this page on Github(opens new window)