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

vve*_*138 2 ruby-on-rails mongoid

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

where('comment_id IS NOT NULL')
Run Code Online (Sandbox Code Playgroud)

怎么用mongoid?

Aru*_*hit 9

你可以用 $ne

where(:comment_id.ne => nil)
Run Code Online (Sandbox Code Playgroud)

查询的相关文档.