Skip to content

DB schema

lasags edited this page Jun 19, 2022 · 16 revisions

MongoDB

Models

collection : user
document 구조 :
{
    "_id": < ObjectId > ,
    "oAuthId: < String > ,
    "user_email": < String > ,
    "user_password": < String > ,
    "user_nickname": < String > ,
    "user_profile_img": < String > ,
    "user_badge": < String > ,
    "user_point": < Number >,
    "user_desc": < String >,
    "isAdmin": < Boolean >,
    "posts": < Array > # posts id 참조
    "gatherings": < Array > # gathering_id 참조 // title, place, date, time
}

collection : gathering
document 구조 :
{
    "_id": < ObjectId > ,
    "gathering_title": < String >,
    "gathering_town": < String >,
    "gathering_place": < String >,
    "gathering_date": < String >,
    "gathering_time": < String >,
    "gathering_longitude" : < String >,
    "gathering_latitude" : < String >,
    "author": < ObjectId >, # user_id 참조 // nickname, profile_img
    "participants": < Array >, # user_id 참조 // nickname, profile_img
}

collection : post
document 구조 : 
{
    "_id": < ObjectId > ,
    "post_title": < String > ,
    "post_desc": < String > ,
    "post_image": < String >,
    "post_createdAt": < Date > ,
    "post_updatedAt": < Date > ,
    "post_comments": < Array >, # post_comment 참조
    "author": < ObjectId >, # user_id 참조 // nickname, profile_img
}

collection : post_comment
document 구조 : 
{
    "_id": < ObjectId > ,
    "post_comment_desc": < String >,
    "post_comment_createdAt": < Date > ,
    "post_comment_updatedAt": < Date > ,
    "post_id": < ObjectId >
    "author": < ObjectId >, # user_id 참조 // nickname, profile_img
}
Clone this wiki locally