how to remove attributes from a Mongoid Model, i.e., not just nullifying their values
You could do this:
Group.collection.update({},
{'$unset' => {:groupable_type => 1}},
:multi => true)
As of version 5.0.0 of Mongoid, the gem has switched from using Moped to use the 'official ruby MongoDB driver' which has a different syntax for updates. Reference: https://docs.mongodb.org/ecosystem/drivers/ruby/
The documentation for collection methods is here: http://api.mongodb.org/ruby/current/Mongo/Collection.html
There are 2 methods, "update" and "update_many". You can use update_many instead of specifying the 'multi' option to update all documents.
Example use for the OPs case:
Group.collection.update_many({}, {'$unset' => {'groupable_type' => true}})
Note you can unset embedded documents using dot notation:
Group.collection.update_many({}, {'$unset' => {'embedded_doc.groupable_type' => true}})
Note it is not well supported by MongoDB to unset / update fields within an array. See this thread for info and workarounds: https://jira.mongodb.org/browse/SERVER-1243.