如何使用Sequelize中的运算符?

时间:2015-02-24 07:05:23

标签: node.js sequelize.js

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);
        }
    }
);

当我运行上面的查询时,它给出了错误

  

" message":" ER_SP_DOES_NOT_EXIST:FUNCTION user_service_appointment.id   不存在"

1 个答案:

答案 0 :(得分:3)

$Between应为$between

如果您使用的是续集的旧版本,则可能需要删除$