Home | 簡體中文 | 繁體中文 | 雜文 | Search | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 知乎專欄 | Email

第 9 章 NoSQL 資料庫設計

目錄

9.1. MongoDB
9.1.1. 配置表 config
9.1.2. 日誌表
9.2. Cassandra
9.2.1. User And Profile
9.2.2. Category
9.2.3. Article
9.2.4. Product and ProductAttribute
9.2.5. Address
9.2.6. 練習

9.1. MongoDB

9.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
    }
}
		

9.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
    }
}