-
Type: Task
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
As per this:
https://github.com/mongoid/mongoid/issues/3085#issuecomment-18944120
The only way I can currently delete an embedded object is by running something like:
r.terminals.destroy_all(_id: r.terminals.last._id)
I thought this had been fixed in bson 2.2.2
>> cart = StoreCart.last >> cart.store_cart_line_items.size => 1 >> cart.store_cart_line_items.last.delete >> cart.save >> cart.reload.store_cart_line_items.size => 1 >> cart = StoreCart.last >> cart.store_cart_line_items.size => 1 -- >> pid = Store.last.store_products.first.id.to_s >> cart.store_cart_line_items.destroy_all(product_id: pid ) >> cart.reload.store_cart_line_items.size => 0
References:
https://github.com/mongoid/mongoid/issues/3085#issuecomment-18944120
https://github.com/mongoid/mongoid/pull/3563
Mongoid 4.0.1
MongoDB shell version: 2.6.5
Bson 2.3.0
ruby 2.2.0