简体   繁体   中英

How to get items from dynamodb using an array of primary keys?

I'm using the documentClient to work with dynamodb .

I have an array of the primary keys.

What method should I use, Scan or Query to get items?

If you have a list of primary key values, you should use the BatchGetItem API. Query does not really help you are, and a Scan is unneeded because you already know the primary keys to index into.

The BatchGetItem operation returns the attributes of one or more items from one or more tables. You identify requested items by primary key.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM