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

    <legend id='pVzzJ'><style id='pVzzJ'><dir id='pVzzJ'><q id='pVzzJ'></q></dir></style></legend><tfoot id='pVzzJ'></tfoot>

        <bdo id='pVzzJ'></bdo><ul id='pVzzJ'></ul>
    1. Sequelize update 不再起作用:“在传递给 update 的选项参数中缺少 where 属性"

      时间:2023-09-03
    2. <legend id='TK0b5'><style id='TK0b5'><dir id='TK0b5'><q id='TK0b5'></q></dir></style></legend>

          <tbody id='TK0b5'></tbody>

          <tfoot id='TK0b5'></tfoot>

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

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

              • 本文介绍了Sequelize update 不再起作用:“在传递给 update 的选项参数中缺少 where 属性"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                官方 API 文档 建议像这样使用 Model.update:

                var gid = ...;
                var uid = ...;
                
                var values = { gid: gid };
                var where = { uid: uid };
                myModel.update(values, where)
                .then(function() {
                    // update callback
                });
                

                但这给了我:传递给更新的选项参数中缺少 where 属性".文档还提到不推荐使用这种用法.看到这个错误让我想,他们已经改变了它.我做错了什么?

                But this gives me: "Missing where attribute in the options parameter passed to update". The docs also mention that this usage is deprecated. Seeing this error makes me think, they already changed it. What am I doing wrong?

                推荐答案

                显然,文档还没有更新.但是 where 行">Model.update API 文档 建议在您的选择前加上 where,如下所示:

                Apparently, the docs have not been updated yet. But the table's where row of the Model.update API docs suggests prefixing your selection with where, like so:

                var gid = ...;
                var uid = ...;
                
                var values = { gid: gid };
                var selector = { 
                  where: { uid: uid }
                };
                myModel.update(values, selector)
                .then(function() {
                    // update callback
                });
                

                而且它有效!

                更新:

                文档已更新(文档也已移动).查看 docs.sequelize.com 上的 Model.update.请注意,options.where 不是可选的(它不在括号 [] 中).

                The docs have since been updated (and the docs have also been moved). Check out Model.update on docs.sequelize.com. Note that options.where is not optional (it is not in brackets []).

                这篇关于Sequelize update 不再起作用:“在传递给 update 的选项参数中缺少 where 属性"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:如何将对象作为数据类型传递给 sequilize 中的数据模型? 下一篇:“SERIAL"处或附近的语法错误;仅使用自动增量

                相关文章

                  <bdo id='1rLM7'></bdo><ul id='1rLM7'></ul>
              • <small id='1rLM7'></small><noframes id='1rLM7'>

                <tfoot id='1rLM7'></tfoot>

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