-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
None
have been battling for days with what seems to be similar problem to this one https://github.com/mongoid/mongoid/issues/2801. I kept it separate however as there are some differences and not sure if it's really related or not. I have model with several levels of embedded documents. Trying to delete or destroy some of those embedded documents doesn't seem to work. I tried several things:
- Loop and destroy all matching certain criteria using destroy_all and delete_all
- Enforce primary using consistency: :true. I made sure requests are going to primary
- Use safe mode
- select individual item and delete it, to eliminate problems with my looping.
Point to make is, I seem to have somehow gathered invalid embedded documents. I tried to remove all validations from the model and issue delete but again to no avail. What I noticed is whenever I delete, the embedded document resurfaces but with a different _id.
First I had the problem in production and development, but with some tinkering my code now seems to work locally, but not in production (Heroku + MongoHQ).
Using:
Mongoid: 3.1.3
Moped: 1.4.5
Thanks.
- duplicates
-
MONGOID-3085 Unable to Destroy Embedded Document
- Closed