我有一个模型的属性,类型为GEOMETRY('polygon'),在数据库mySQL的sequelize中 .

此类型的属性从BLOB类型保存在DB中 .

我想在此模型上执行sequelize隐式findOne操作,在where子句中指定此几何类型属性 .

当我尝试做同样的事情时,它给出了一个没有任何错误语句的错误,而如果我在where子句中指定了表的任何其他字段,它会给出结果 .

我的代码示例如下:

用户模型:

module.exports = {

    attributes: {
        geometry: {
            type: Sequelize.GEOMETRY('POLYGON')
        }
    }
}

用户控制器:

find: function(req, res) {

        var point = {
            type: 'Polygon',
            coordinates: [
                [
                    [100.0, 0.0],
                    [101.0, 0.0],
                    [101.0, 1.0],
                    [100.0, 1.0],
                    [100.0, 0.0]
                ]
            ]
        };

        User.findOne({
            where: {
              "geometry": point
            }
        }).then(function(polygonData) {
            return res.ok(polygonData);
        }).catch(function(exception) {
            return res.badRequest(exception);
        });

    }

当我试图检索相同的,它给我错误对象为:

{
  "error@context":{
                      }
}

我已经提到了一些已经存在的问题:

Mysql query check the blob column type in where clause

Using BLOB in where clause in MySQL

但仍然徒劳无功 .

如果有人可以帮我这个,那么我可以在where子句中指定blob类型,这将是很棒的 . 我不喜欢通过原始查询来做,但如果没有其他方式,那么无论如何必须 .

需要更多信息,可以参考here .