I'm going to build my first real project in Rails that consist in a web app made of 3 main parts:
- The static part where no database is used
- The User registration part which will require a database and I can use MySQL since each user's row will have the same fields
- The "App" where users will be able to create, organize, edit... items in collections and share them with other users
There will be several item types and each one will have different options for example I may have "video" items with the following options:
- id
- user_id
- collection_id
- title
- platform (if embedded)
- url (if embedded)
- file name (if hosted on my app)
- file size (id hosted on my app)
and "map" items:
- id
- user_id
- collection_id
- title
- platform (google maps, bing maps...)
- location
- url
- map size
As you can while for users I may use MySQL for items the flexibility of MongoDB may be useful since each item may need different options then another item
Up to now I've always used PHP and MySQL (always on shared hosting for small projects) and scalability is a totally new word for me.
I have time to learn but I would like to be able to do something concrete in something like 1 month.
I've read a lot about MongoDB and NoSQL vs RDMS and MySQL and after trying it I have to say that I like how MongoDB works: no tables, no rows and its documents JSON like so:
- In my situation what would you raccomend? why?
- About scalability there may be problems with MongoDB? if yes when (in term of DB size) and may these problems slow down my app considerably?
Edit: how the app will work
Since many asked this is how I'd like the app to work:
- A user sign up
- He's logged in
- He create his first collection iside which he can create infinite items
- Items are of various type and each type need different data to be saved in the database and type of items may be added or modified
Users may create other collections and items inside it.
So we have CRUD for collections and items inside of them and each collection/item is referred to a specific user
The main problem with MySQL is that it hasn't a flexible schema, there is way to solve this (a workaround?)?
Thinking about NoSQL the only doubt I have is about join, for example given a certain colection I want to retrieve datas related to the User with id = user_id field in the collection
EDIT: Idea to keep using MySQL
Create a field in the "items" table with optional settings, each setting divided by a | or another symbol.
Then I will save somewhere a structure of each item optional settings, for example the "notes" item type need two optional settings "colour" and "strange_setting", when I get the data from MySQL i will split the field for optional settings into an array knowing that the first item in the array is for "colour" and so on.
What do you think? there are problem with that solution? do you have other ideas?