Open Startouf opened 6 years ago
I think this is an issue with the mongoid (v6) gem itself: https://jira.mongodb.org/browse/MONGOID-4469
Thoughts?
Edit: It looks like mongoid v7 fixes the problem. Is it possible for you to try to upgrade to that?
I tried but upgrading to Mongoid v7 requires that I upgrade too many other gems. Currently I'm stuck on mongoid 6.1.1 but I'll be working on the upgrade.
I also discovered another problem (which might be fixed with a mongoid upgrade) : It seems like
remove_logo!
does not seem to work properly on embedded documents
model.nested_document.logo.present? # true
model.nested_document.remove_logo! # true
model.nested_document.save! # true
model.nested_document.logo.present? # false
model.reload
model.nested_document.logo.present? # true
# Note that I also tried saving directly the parent `model.save! # true` which did not work better.
It seems like the logo
attributes keeps the value __old__
which causes the method .present?
to return true. I did not have this bug with carrierwave < 1.x
Note that the following works :
model.nested_document.remove_attribute('logo') #=> "_old_"
model.nested_document.save!
model.nested_document.company_logo.present? #=> false
I'm not sure if I should open a ticket or wait to see if Mongoid v7 will fix that too
@Startouf I had the same error and updated Mongoid to 6.4.2 and it went away. Maybe try it out since it's still on the 6.x branch?
@rmm5t I have migrated to Mongo v7 a couple days ago on our production app (it was quite a pain btw) and the error's gone, and it seems like @niksosf also fixed it by bumping Mongoid6, so I guess we can close ?
Or do we need to enforce some version dependency on the Gemfile to avoid this ?
I agree I think it’s healthier moving forward that we close this instead of waiting for a fix to carrierwave
Nik So
On Nov 6, 2018, at 6:09 PM, Cyril Duchon-Doris notifications@github.com wrote:
@rmm5t I have migrated to Mongo v7 a couple days ago on our production app (it was quite a pain btw) and the error's gone, and it seems like @niksosf also fixed it by bumping Mongoid6, so I guess we can close ?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Thanks for the updates @niksosf and @Startouf. I'm glad things were fixed by the core mongoid gem (both in the v6 and v7 branches of development).
Let me give this some thought as to whether we should modify the gemspec here or not.
It seems that the $pushAll operator was removed in MongoDB 3.6, making systematic crashes when trying to update an uploader
My gem/server versions
Here is a full stack trace. At first sight it doesn not seem related to mongoid carrierwave, but the bug only occurs when I try to add an image file so I'm not sure what to think of it