I want to list all the models which have a respective collection in my mongodb database? I'm using mongoid
gem for for MongoDB.
I would try something like this
ActiveRecord::Base.send :subclasses
which works fine, but I'm not using ActiveRecord.
There's Mongoid::Config#models
:
Get all the models in the application - this is everything that includes
Mongoid::Document
.
All Config
methods can be accessed from the Mongoid
module, so you can call:
Mongoid.models #=> [...]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With