【发布时间】:2014-03-20 16:54:58
【问题描述】:
我使用 Ruby gem mongoid 并想查找不继承自任何东西的记录。
所以有 2 个模型。一个基类 Product 和一个继承自 Product 的类 Product::Translation。
如何找到不继承任何东西且没有 _type 字段的纯产品记录。
我尝试了这些查询但不起作用:
- Product.where(:_type.exists => false)
- Product.exists(_type: false)
- Product.where(_type: nil)
- Product.exists(_type: false)
【问题讨论】:
-
关于inheritance_column 的内容。它等于“_type”。
标签: ruby-on-rails ruby mongodb mongoid