-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
On the other side of an HABTM relationship, on the inverse_of model Mongoid is using $set instead of $pushAll to update the "*_ids" attribute. This can cause data loss in a quick moving application. Using 2.2.0 gem here.
Here's a snippet from my logs:
MONGODB laylow_development['users'].update({"_id"=>BSON::ObjectId('4e72a09573036a70ca000004')}, {"$set"=>{"interaction_ids"=>[BSON::ObjectId('4e9142fb73036a3f61000005')], "updated_at"=>2011-10-09 06:50:11 UTC}}) MONGODB laylow_development['interactions'].update({"_id"=>BSON::ObjectId('4e9142fb73036a3f61000005')}, {"$pushAll"=>{"participant_ids"=>[BSON::ObjectId('4e72a09573036a70ca000004')]}})