Hi all ,
I would like to ask a few questions about schema design because I’m currently using Atlas + Realm to play around and learn.
The one thing that is confusing to me is why and when we need to split data up in collections because theoretically, my whole application could be one giant schema which is 1 collection.
I will use Trello as an example to explain what I mean. Hope you all know what Trello is and how it works, basically, users can create boards and every board is an own project management platform so to say where you can add stuff like todos, here how I would build the Schema for the whole Trello clone in 1 collection.
Collection Name is Boards.
{
"title": "board",
"properties": {
"_id": {
"bsonType": "objectId"
},
"lanes": {
"bsonType": "array",
"items": {
"bsonType": "object",
"properties": {
"cards": {
"bsonType": "array",
"items": {
"bsonType": "object",
"properties": {
"description": {
"bsonType": "string"
},
"id": {
"bsonType": "objectId"
},
"label": {
"bsonType": "string"
},
"title": {
"bsonType": "string"
}
}
}
},
"id": {
"bsonType": "objectId"
},
"label": {
"bsonType": "string"
},
"title": {
"bsonType": "string"
}
}
}
}
}
}
This is how you could build a whole application with 1Schema but I assume it is not the right way to do it, so why and when and how do I know when to split it up in a new collection?
Thanks