Mongo schema design for todo list like Trello

160 views
Skip to first unread message

J

unread,
Feb 8, 2014, 2:16:17 PM2/8/14
to mongod...@googlegroups.com
I am trying to design a API to create a site like Trello.  Each user can have multiple boards(projects) and each board can have multiple lists, and each list can have multiple items.  The order of the list and items can be rearranged anytime by the user.  Here is my initial design, but I'm not sure if its good (just read the mongo documentation last night)

List of boards:
{
    boards
: [
       
{
            _id
: 901292190
            name
: 'board1'
       
}
   
]
}


Viewing a single board:
{
   
_id: 901292190
    name
: 'board 1',
    lists
: [
       
{
            name
: 'todo',
            items
: [
               
{
                    name
: 'go shopping',
                    priority
: 1,
                    createdby
: 'user1',
                    assignedto
: 'user2'
               
},
               
{
                    name
: 'go to school',
                    priority
: 2,
                    createdby
: 'user1',
                    assignedto
: 'user2'
               
}
           
]
       
},
       
{
            name
: 'finished',
            items
: [
               
{
                    name
: 'programming',
                    priority
: 1,
                    createdby
: 'user1',
                    assignedto
: 'user2'
               
}
           
]
       
}
   
]
}

Asya Kamsky

unread,
Feb 8, 2014, 9:24:35 PM2/8/14
to mongodb-user
I'm not clear how many collections you will have in your proposed schema.

I'm also not sure how you will be accessing/manipulating these
objects, so it's hard to say if the schema will work well.

In general you want to think about how you want to read and write your
data and structure it to be as optimal for those operations as
possible. And optimal doesn't just mean now, but also when users
have been using and creating data for a while.

That means you should be careful not to embed everything inside of its
parent object if after a while you won't care about older items - only
keep together items that you always want to have together...

Asya
> --
> --
> You received this message because you are subscribed to the Google
> Groups "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com
> To unsubscribe from this group, send email to
> mongodb-user...@googlegroups.com
> See also the IRC channel -- freenode.net#mongodb
>
> ---
> You received this message because you are subscribed to the Google Groups
> "mongodb-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mongodb-user...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
Reply all
Reply to author
Forward
0 new messages