I am new to MongoDB and MongooseJS. I am also quite inept at creating databases, sorry.
First question
what is the difference between sub docs and population? Looking at the docs example, a Parent-Children subdoc seems very similar to a Person-Stories population.
Database schema question
Scenario: users can create a number of Canvas. Each Canvas can host a number of Shapes. Each Shape can be of 2 types: Simple, or Complex. A Simple shape can be a Square or a Circle (objects). A Complex shape is made of a Frame and a Material.
Canvas
|
Shape
/ \
Simple Complex: Frame, Material
/ \
Square Circle
Now, a Shape can be assigned to only 1 Canvas but can be moved between Canvases or live alone outside a Canvas. Frame and Material can be created independently (live alone) and added to a Complex Shape (each Complex Shape can only have 1 frame and 1 material).
Some of the queries I would have to implement are asking for all the shapes in a specific Canvas, or all the shapes that are using a certain material, or again all the Frames that are being used by shapes.
Since the difference between sub-doc and population is not clear to me, I am not even sure how to begin... any help or example would be appreciated (I am not expecting a full and working database schema).