Hi,
I am new at using mongodb and I am working on a Trello like app, where you can create boards with columns and tickets in it.
I have started to model the DB like this.
Boards collection
{
_id: 1,
columns: [
{
canAddTicket: true,
display: true,
isDeleteable: false,
id: 1,
name: 'Todo',
nameSanitized: 'todo',
position: 1,
tasks: [{
title: 'My task'
archived: false
done: false
number: 1
id: 1
},
{
title: 'My task 2'
archived: false
done: false
number: 2
id: 2
}
]
},
{
canAddTicket: true,
display: true,
isDeleteable: false,
id: '0828e54f-9d65-4451-8740-3a333b868265',
name: 'Doing',
nameSanitized: 'doing',
position: 2,
tasks: []
}
]
}
Tasks collection
{
_id: 1
done: false,
title: 'My task',
description: 'My big desc',
members: [
],
comments: [
],
columnId: 1,
boardId: 1
}
The idea is when I create tasks, I store the entire version with big description, comments, history and every info in it.
Then I add a small version in a column.
This way, I can display my board and the tickets with one query by querying the Boards document
If I need to get the detail, I will query the Tasks document.
I also need to change columns position, for now I have planned to use $pull and $push to change position.
I came here to humbly ask the community if this solution looks good to you, or will it cause performance issue to update columns position ? I am also worried about concurrency, if columns got moved when people move ticket from a column to another one ? Maybe you will think of another problem I cannot think about.
Thanks a lot in advance,