Created
July 17, 2010 22:18
-
-
Save bernerdschaefer/479896 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mongoid' | |
Mongoid.configure do |config| | |
config.master = Mongo::Connection.new.db('testing') | |
end | |
class Parent | |
include Mongoid::Document | |
field :name | |
collection.remove | |
end | |
Parent.create | |
Parent.create(:name => "John") | |
Parent.where(:name => nil).size # => 1 | |
Parent.collection.find(:name => {'$in' => [nil]}).to_a.size # => 0 | |
Parent.where(:name.in => [nil]).size # => 0 | |
# mongo | |
# > use testing | |
# > db.parents.count({ name : { $in : [null] } }) # => 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment