0

我正在尝试获取positive_power_values,它是数组中的meter_id


1.9.3p194 :100 > ppv = PositivePowerValue.first

PositivePowerValue _id: 518dfd25a81fc61ece8d3d23, _type: nil, deleted_at: nil, created_at: "2013-05-11 19:04:54 +0800", updated_at: nil, positive_active_energy_power_indication: "100.00", positive_reactive_power_indication: "50", use_flag: "true", meter_id: "4f71181b6e92fe054b000006" 1.9.3p194 :101 > PositivePowerValue.where(:meter_id.in => ["4f71181b6e92fe054b000006"]).count => 0

我文德为什么是0?我需要在数组中的meter_id 中获取positive_power_values!

4

1 回答 1

0

你在使用 mongoid 吗?

正确的语法是:

PositivePowerValue.in(:meter_id => ["4f71181b6e92fe054b000006"])
于 2013-05-14T07:16:18.077 回答