【问题标题】:How make a query in to Mongoid, 'where is not null'?如何对 Mongoid 进行查询,'where is not null'?
【发布时间】:2015-04-25 21:52:03
【问题描述】:

如何查询Mongoid,'where is not null'?例如

where('comment_id IS NOT NULL')

如何用mongoid制作?

【问题讨论】:

  • 是的,它起作用了。我一直等到它需要时间来做。来自stackoverflow的初学者的此类规则)
  • 没问题.. 来吧,伙计! :-) :-)

标签: ruby-on-rails mongoid


【解决方案1】:

你可以试试这个

Model.where(:comment_id.exists => true)

【讨论】:

    【解决方案2】:

    你可以用$ne

    where(:comment_id.ne => nil)
    

    相关documentation of queries

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-11-14
      • 1970-01-01
      • 2017-05-09
      • 1970-01-01
      • 2014-12-08
      • 1970-01-01
      • 2021-05-12
      • 2018-11-25
      相关资源
      最近更新 更多