<i id='j8YQl'><tr id='j8YQl'><dt id='j8YQl'><q id='j8YQl'><span id='j8YQl'><b id='j8YQl'><form id='j8YQl'><ins id='j8YQl'></ins><ul id='j8YQl'></ul><sub id='j8YQl'></sub></form><legend id='j8YQl'></legend><bdo id='j8YQl'><pre id='j8YQl'><center id='j8YQl'></center></pre></bdo></b><th id='j8YQl'></th></span></q></dt></tr></i><div id='j8YQl'><tfoot id='j8YQl'></tfoot><dl id='j8YQl'><fieldset id='j8YQl'></fieldset></dl></div>
    1. <tfoot id='j8YQl'></tfoot>

      <legend id='j8YQl'><style id='j8YQl'><dir id='j8YQl'><q id='j8YQl'></q></dir></style></legend>

      • <bdo id='j8YQl'></bdo><ul id='j8YQl'></ul>

        <small id='j8YQl'></small><noframes id='j8YQl'>

        DynamoDB:仅当它已经存在时才更新项目

        时间:2024-05-10

      1. <legend id='kTtVv'><style id='kTtVv'><dir id='kTtVv'><q id='kTtVv'></q></dir></style></legend>
      2. <tfoot id='kTtVv'></tfoot>

                <tbody id='kTtVv'></tbody>
                  <bdo id='kTtVv'></bdo><ul id='kTtVv'></ul>
                • <i id='kTtVv'><tr id='kTtVv'><dt id='kTtVv'><q id='kTtVv'><span id='kTtVv'><b id='kTtVv'><form id='kTtVv'><ins id='kTtVv'></ins><ul id='kTtVv'></ul><sub id='kTtVv'></sub></form><legend id='kTtVv'></legend><bdo id='kTtVv'><pre id='kTtVv'><center id='kTtVv'></center></pre></bdo></b><th id='kTtVv'></th></span></q></dt></tr></i><div id='kTtVv'><tfoot id='kTtVv'></tfoot><dl id='kTtVv'><fieldset id='kTtVv'></fieldset></dl></div>

                  <small id='kTtVv'></small><noframes id='kTtVv'>

                  本文介绍了DynamoDB:仅当它已经存在时才更新项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  默认情况下,如果具有指定索引的对象不存在,DynamoDB 将创建一个新条目.有没有办法阻止这种情况发生?我可以在更新之前在表中查询密钥,但最好在一个请求中完成所有操作.

                  By default DynamoDB will make a new entry if an object with the specified index doesn't exist. Is there a way to stop this from occurring? I could just query the table for the key before updating, but it would be nice to do it all in one request.

                  推荐答案

                  使用条件表达式 id = :id 其中 id 是属性名(或主键名您的情况)和 :id 是值(您要更新的项目的键).

                  Use conditional expression id = :id where id is the attribute name (or primary key name in your case) and :id is the value (key of the item you want to update).

                  条件表达式总是在任何写入之前进行评估.如果该表达式的计算结果不是 true(并且如果该键不存在或不同,则不会),它不会更新或放置新项目.

                  Conditional expression is always evaluated before any writing. If that expression doesn't evaluate to true (and it doesn't if that key doesn't exist or is different), it doesn't update or put a new item.

                  这篇关于DynamoDB:仅当它已经存在时才更新项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何获取 DynamoDB 表中的项目总数? 下一篇:使用 PHP 使用 AWS DynamoDB 进行分页

                  相关文章

                  <i id='b3OKe'><tr id='b3OKe'><dt id='b3OKe'><q id='b3OKe'><span id='b3OKe'><b id='b3OKe'><form id='b3OKe'><ins id='b3OKe'></ins><ul id='b3OKe'></ul><sub id='b3OKe'></sub></form><legend id='b3OKe'></legend><bdo id='b3OKe'><pre id='b3OKe'><center id='b3OKe'></center></pre></bdo></b><th id='b3OKe'></th></span></q></dt></tr></i><div id='b3OKe'><tfoot id='b3OKe'></tfoot><dl id='b3OKe'><fieldset id='b3OKe'></fieldset></dl></div>
                  • <bdo id='b3OKe'></bdo><ul id='b3OKe'></ul>

                • <tfoot id='b3OKe'></tfoot>
                • <small id='b3OKe'></small><noframes id='b3OKe'>

                      <legend id='b3OKe'><style id='b3OKe'><dir id='b3OKe'><q id='b3OKe'></q></dir></style></legend>