Starting with version 5.0.0 of Mongoid, the pearl has switched from using Moped to using the "official ruby MongoDB driver", which has a different syntax for updates. Link: https://docs.mongodb.org/ecosystem/drivers/ruby/
The documentation for the collection methods is here: http://api.mongodb.org/ruby/current/Mongo/Collection.html
There are two methods: "update" and "update_many". You can use update_many instead of specifying the "multi" option to update all documents.
Usage example for OPs case:
Group.collection.update_many({}, {'$unset' => {'groupable_type' => true}})
Please note that you can delete embedded documents using dot notation:
Group.collection.update_many({}, {'$unset' => {'embedded_doc.groupable_type' => true}})
Note that MongoDB is not supported to disable / update fields in an array. See this topic for information and workarounds: https://jira.mongodb.org/browse/SERVER-1243 .
source share