Topic: user defined collections

For the project I'm currently working on, i have to allow all the users to define their own collections ( models ), with custom attributes( database fields ), having relations between them and also validations. The users should also be able to insert data in their collections, and also use it their mustache views.
Having all this requirements, my first guess would be that a nonsql( linke mongodb ) would be more suitable for this project than a relational database ( like mysql ). To simplify the work, i would use an orm like Mongoid, and i would define a class for mapping each of the user defined collection as the application needs it. But I am not sure if this is the best way to go, as i am not sure how efficient is to have dynamically created classes for each of the collections, in case we have to deal with hundreds, or maybe thousands of them. Any suggestions?