【问题标题】:Querying Serialized Properties isn't working查询序列化属性不起作用
【发布时间】:2019-07-23 22:19:12
【问题描述】:

我想查询 neo4jrb 中的序列化字段或属性,但不工作。

我有一个数组类型的序列化属性,类似这样:

Class Thing
  include Neo4j::ActiveNode

  property :coordinates, default: [0,0]

  serialize :coordinates, type: Array
end

我要查询

Thing.where(coordinates: [1,2])

返回 [ ],但我有一个具有 [1,2] 坐标的东西。

问这个问题的方法是什么?

【问题讨论】:

    标签: ruby-on-rails neo4jrb


    【解决方案1】:

    尝试以下查询:

    匹配(结果:'东西') WHERE (result.coordinates = [1, 2] ) 返回结果

    【讨论】:

    • 是的!这个作品我试过Thing.as(:cosita).where("cosita.coordinates = [1,2]"),它奏效了
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-07-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-22
    相关资源
    最近更新 更多