-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
Labels:
ruby require "spec_helper" module Test_2812 class Sandwich include Mongoid::Document has_and_belongs_to_many :meats end class Meat include Mongoid::Document has_and_belongs_to_many :sandwiches end end describe "2812" do it "issue" do # create a meats collection, without it, no error Test_2812::Meat.create! sandwich = Test_2812::Sandwich.create! sandwich.destroy sandwich.meats.count.should == 0 end end
1) 2812 issue Failure/Error: sandwich.meats.count.should == 0 Moped::Errors::OperationFailure: The operation: #<Moped::Protocol::Command @length=124 @request_id=8 @response_to=0 @op_code=2004 @flags=[] @full_collection_name="mongoid_test.$cmd" @skip=0 @limit=-1 @selector={:count=>"test_2812_meats", :query=>{"$and"=>[{"_id"=>{"$in"=>nil}}]}} @fields=nil> failed with error 12580: "exception: invalid query" See https://github.com/mongodb/mongo/blob/master/docs/errors.md for details about this error. # ./lib/mongoid/contextual/mongo.rb:54:in `count' # ./lib/mongoid/contextual.rb:19:in `count' # ./lib/mongoid/relations/referenced/many.rb:10:in `count' # ./spec/dblock/2812_spec.rb:23:in `block (2 levels) in <top (required)>'