如何在Sequelize中使用操作符?

时间:2022-04-12 20:17:14
var conditionalData = {
    id: {
        $Between: [11, 15]
    },
    technician_id: technicianId
};
var attributes = ['id', 'service_start_time', 'service_end_time'];
userServiceAppointmentModel.findAll({
    where: conditionalData,
    attributes: attributes
}).complete(function (err, serviceAppointmentResponse) {
    if (err) {
        var response = constants.responseErrors.FETCHING_DATA;
        return callback(err, null);
    } else {
        if (serviceAppointmentResponse.length > 0) {
            var response = constants.responseErrors.NO_AVAILABLE_SLOTS_IN_YOUR_CALENDAR;
            return callback(response, null);
        }
    }
);

When I run the above query it gives me error as

当我运行上面的查询时,它会给我一个as错误

"message": "ER_SP_DOES_NOT_EXIST: FUNCTION user_service_appointment.id does not exist"

“消息”:“user_service_appointment ER_SP_DOES_NOT_EXIST:函数。id是不存在的”

1 个解决方案

#1


3  

$Between should be $between.

之间应该是美元之间。

If you are using an older version of sequelize, you may need to remove the $ too

如果您正在使用一个旧版本的sequelize,您可能也需要删除$

#1


3  

$Between should be $between.

之间应该是美元之间。

If you are using an older version of sequelize, you may need to remove the $ too

如果您正在使用一个旧版本的sequelize,您可能也需要删除$

相关文章