The BatchGetItem operation retrieves multiple items from a table in a single call.
- Description:
The
BatchGetItemoperation retrieves multiple items from a table in a single call.
- Source:
- See:
Methods
(inner) batchGetFor(tableName, keys) → {Promise}
- Description:
Returns the attributes of one or more items from a table. Requested items are identified by primary key. A key represented by a
Numberor aStringwill be assumed to be namedid. Items will be fetched fromtableName. You would typically use this function throughforTable.
- Source:
Examples
// Fetch documents of `id` 42, 33 and 7
await batchGetFor('SomeTable')([42, 33, 7]);
// Fetch documents of keys `{ foo: 42 }` and `{ foo: 33 }`
await batchGetFor('SomeTable')([{ foo: 42 }, { foo: 33 }]);
// Retrieve only `name` and `age` fields
await batchGetFor('SomeTable')([42, 33], { ProjectionExpression: 'name, age' });
// Exported from `forTable`
const { batchGet } = forTable('SomeTable');
await batchGet([42, 33, 7]);
Parameters:
| Name | Type | Description |
|---|---|---|
tableName |
string | The name of the DynamoDB table to run the query on |
keys |
Array.<*> | * | Identifiers of elements to get from |
Returns:
Resolves to the response from DynamoDB client.
- Type
- Promise