• <small id='IfMM3'></small><noframes id='IfMM3'>

      <i id='IfMM3'><tr id='IfMM3'><dt id='IfMM3'><q id='IfMM3'><span id='IfMM3'><b id='IfMM3'><form id='IfMM3'><ins id='IfMM3'></ins><ul id='IfMM3'></ul><sub id='IfMM3'></sub></form><legend id='IfMM3'></legend><bdo id='IfMM3'><pre id='IfMM3'><center id='IfMM3'></center></pre></bdo></b><th id='IfMM3'></th></span></q></dt></tr></i><div id='IfMM3'><tfoot id='IfMM3'></tfoot><dl id='IfMM3'><fieldset id='IfMM3'></fieldset></dl></div>
        <bdo id='IfMM3'></bdo><ul id='IfMM3'></ul>
        <tfoot id='IfMM3'></tfoot><legend id='IfMM3'><style id='IfMM3'><dir id='IfMM3'><q id='IfMM3'></q></dir></style></legend>
      1. 从数组中创建表中的多行?

        时间:2023-09-03

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

              <tbody id='0C8RT'></tbody>
            <tfoot id='0C8RT'></tfoot>
            • <small id='0C8RT'></small><noframes id='0C8RT'>

              • <bdo id='0C8RT'></bdo><ul id='0C8RT'></ul>

                1. 本文介绍了从数组中创建表中的多行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  是否可以使用 sequelize.js 从数组中一次添加多行?这是我的代码:

                  Is possible to add multiple rows at once from array with sequelize.js? This is my code:

                    var user = User.build({
                      email: req.body.email,
                      password: req.body.password,
                      userlevel: '3',
                    });
                  
                    User
                    .find({ where: { email: req.body.email } })
                    .then(function(existingUser){
                  
                      if (existingUser) {
                        return res.redirect('/staff');
                      }
                  
                      user
                      .save()
                      .complete(function(err){
                        if (err) return next(err);
                        res.redirect('/staff');
                      });
                    }).catch(function(err){
                      return next(err);
                    });
                  

                  感谢您的建议!

                  推荐答案

                  https://sequelize.readthedocs.io/en/v3/docs/instances/#working-in-bulk-creating-updating-and-一次销毁多行

                  User.bulkCreate([{ /*  record one */ }, { /* record two */ }.. ])
                  

                  这篇关于从数组中创建表中的多行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:对象 SequelizeInstance 正在传递 下一篇:Promise.all(...).spread 不是并行运行 Promise 时的函数

                  相关文章

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

                    1. <small id='81l5x'></small><noframes id='81l5x'>

                        <bdo id='81l5x'></bdo><ul id='81l5x'></ul>
                      <legend id='81l5x'><style id='81l5x'><dir id='81l5x'><q id='81l5x'></q></dir></style></legend>