gpt4 book ai didi

sequelize.js - Sequelize : Why Is This $or Not Working?

转载 作者:行者123 更新时间:2023-12-03 22:41:47 25 4
gpt4 key购买 nike

这有效:

        var args = {fromID: 1, toID: 2};
var altArgs = {};
altArgs.fromID = args.toID;
altArgs.toID = args.fromID;
var ret = connectors.IM.findAll({ $or: [args, altArgs] }).then((res) => res.map((item) => item.dataValues));

但这不是,即使就 $ 或语法而言,它对我来说看起来完全一样:
        const {fromID, toID} = args;
var fromArgs = {};
var toArgs = {};
fromArgs.userID = fromID;
toArgs.userID = toID;

var ret = connectors.myUserData.findAll({ $or: [fromArgs, toArgs] }).then((res) => res.map((item) => item.dataValues));

myUserData 确实包含一个 userID 字段,我要查找的值可以在表中找到。是什么阻止了第二个代码块的工作?

最佳答案

缺少 where Prop :.findAll({where: { $or: [fromArgs, toArgs]}})

关于sequelize.js - Sequelize : Why Is This $or Not Working?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40339380/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com