mGet #
Available since 7.8.0
Gets multiple realtime documents.
This method uses the Document.mGet method under the hood to retrieve documents.
Arguments #
mGet (index: string, collection: string, ids: string[]): Promise<{ successes: RealtimeDocument[]; errors: string[]; }>
Argument | Type | Description |
---|---|---|
index | string | Index name |
collection | string | Collection name |
ids | string[] | Document IDs |
Usage #
const observer = new Observer(sdk);
const docs = await observer.get('nyc-open-data', 'yellow-taxi', ['foo', 'bar']);
console.log(docs);
/*
[
RealtimeDocument {
_id: 'foo',
_source: {
name: 'aschen',
age: '28',
_kuzzle_info: {
author: '-1',
createdAt: 1638432270522,
updatedAt: null,
updater: null
}
},
deleted: false
},
RealtimeDocument {
_id: 'bar',
_source: {
name: 'dana',
age: '30',
_kuzzle_info: {
author: '-1',
createdAt: 1638432270522,
updatedAt: null,
updater: null
}
},
deleted: false
}
]
*/
Edit this page on Github(opens new window)