Skip to content

Database Design

Wenlin Mao edited this page Oct 21, 2018 · 1 revision

UCSDCSSA Duanzu Database Design

Description

All collection name, fields name follows naming format: All lower-case, separate words using _.

User

{
    "_id": "<USER_ID: automatically generated by MongoDb>",
    "username": "<USER NAME: length 4-20 string with only a-z, A-Z, 0-9, ~!@#$%^&*-=>",
    "email": "<USER EMAIL>",
    "real_name": "<>",
    "qr_code": ""
}

Leasing

{
    "_id": "Leasing_ID: automatically generated by MongoDb",
    "user_id": "",
    "start_date": "Date",
    "end_date": "Date",
    "complex_id": "Community_ID: Id associated with each complex",
    "apt_bedroom_amount": "Integer: number of bedrooms",
    "apt_bathroom_amount": "Integer: number of bathrooms",
    "room_avail":[
        {
            "type": "living",
            "price":0
        }, {
            "type": "bedroom",
            "price":0
        }
    ],
    "gender_req": "0:male only, 1:female only, 2:both",
    "user_description": "",
    "facility":{
        "wifi":true,
        "pet":true,
        "washer":true,
        "furniture":false,
        "printer":false,
        "ac":false,
        "heater":true,
        "parking":true,
        "kitchen":true
    },
    "notice": "",
    "location":{
        "lng": "float",
        "lat": "float"
    },
    "status": "0:published, 1:saved, 2:unavailable",
    "img_url": [
        "string url",
        "string url"
    ]
}

Complex

{
    "_id": "<Leasing_ID: automatically generated by MongoDb>",
    "name": "<string>",
    "facility":{
        "gym":true,
        "pool":true,
        "printer":true,
        "locker":false,
        "security": "门禁 or 保安",
    },
    "location":{
        "lng": "float",
        "lat": "float",
    },
    "website": "Complex URL",
    "description": "CSSA Description",
    "img_url":["string url","string url"],
}
Clone this wiki locally