简体   繁体   中英

How ignore some fields in putitem in DynamoDB

I want replace existing record each time, So putItem is right action for me. But each records have a creation date which i don't want update it. because creation date always the same.

Is any to implement this without query DynamoDB firstly? Thanks. BTW: I did not use DynamoDBMapper.

PutItem

Creates a new item, or replaces an old item with a new item. If an item that has the same primary key as the new item already exists in the specified table, the new item completely replaces the existing item

UpdateItem

Edits an existing item's attributes, or adds a new item to the table if it does not already exist. You can put, delete, or add attribute values. You can also perform a conditional update on an existing item (insert a new attribute name-value pair if it doesn't exist, or replace an existing name-value pair if it has certain expected attribute values)

Answer: You should be using UpdateItem, not PutItem.

If you really do want to use putItem then you have to query first.

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