I need to have collections such as:
- client1.users
- client1.images
- client2.users
- client2.images
MongoDB supports Collection namespacing. http://www.mongodb.org/display/DOCS/Using+a+Large+Number+of+Collections
Using the Ruby driver for MongoDB that won’t be a problem but I want to have an ODM.
How can I use namespace collections with Mongoid?
You can put your models into namespaces with Mongoid. You will have to specify the fully qualified class_name in any associations that you define, e.g.
Mongoid will map these two classes to MongoDB collections client1_images and client1_users respectively.