Home | 簡體中文 | 繁體中文 | 雜文 | 知乎專欄 | Github | OSChina 博客 | 雲社區 | 雲棲社區 | Facebook | Linkedin | 視頻教程 | 打賞(Donations) | About
知乎專欄多維度架構 微信號 netkiller-ebook | QQ群:128659835 請註明“讀者”

第 23 章 NoSQL OOD(Object-Oriented Design)

目錄

23.1. MongoDB
23.1.1. 配置表 config
23.1.2. 日誌表
23.2. Cassandra
23.2.1. User And Profile
23.2.2. Category
23.2.3. Article
23.2.4. Product and ProductAttribute
23.2.5. Address
23.2.6. 練習

23.1. MongoDB

23.1.1. 配置表 config

{
    "_id" : ObjectId("5799a8535a855eca473977e1"),
    "key" : "payment",
    "value" : {
        "alpay" : true,
        "tenpay" : false,
        "unionpay" : false,
    }
},

{
    "_id" : ObjectId("5799a8535a855eca47397723"),
    "key" : "signup",
    "value" : {
        "online" : true,
        "manual" : false
    }
}
		

23.1.2. 日誌表


tag ENUM('unknow','www','user','admin') '日誌標籤',
time '插入時間',
facility ENUM('config','unionpay','sms','email') '類別',
priority ENUM('info','warning','error','critical','exception','debug') '級別',
message '內容'

/* 1 */
{
    "_id" : ObjectId("5799b0175a855eca473977e2"),
    "tag" : "www",
    "time" : "2016-07-30 12:12:00",
    "facility" : "config",
    "priority" : "info",
    "message" : "xxxxxxxxxxxxxxxxxx"
}

/* 2 */
{
    "_id" : ObjectId("5799b10f5a855eca473977e3"),
    "tag" : "www",
    "time" : "2016-07-30 12:12:00",
    "facility" : "config",
    "priority" : "info",
    "message" : {
        "name" : "neo",
        "age" : 30,
        "sex" : true
    }
}