第 9 章 NoSQL OOD(Object-Oriented Design)

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

原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。

时间: 2024-07-31 06:59:12

第 9 章 NoSQL OOD(Object-Oriented Design)的相关文章

Study object oriented stuff once again, please suggest book names

Years ago, I learned object oriented design and analysis in Chinese books. Recently I was thinking about brushing up my knowledge once again, therefore I decided to read famous English books about object oriented design and analysis. Right now I'm re

【设计模式】Object Oriented面向对象思想剖析

OO思维(Object Oriented以对象为方向) 这里以"老张开车去东北"为例子. 创建一个ThinkInOO的工程: 先来看看小明的非面向对象思维的工程: package cn.edu.ThinkInOO; public class Test1 { public static void main(String[] args) { System.out.println("老张开车去东北"); } } 是不是没什么属性呢?于是他又改了: package cn.e

第 19 章 JSON (JavaScript Object Notation)

19.1. javax.json.* 19.1.1. Json 编码 package netkiller.json; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import javax.json.*; public final class Writer { public static void main(String[

Java中的面向对象(object oriented)编程简介

程序包含两部分组成: 数据 和操作数据的函数; 面向过程的设计方法是自顶向下的功能分解, 把一个需求分解成多个子功能, 开发子功能并进行单元测试, 在组装成一个完整的应用程序; 问题: 1. 程序主要关注功能, 其次数据, 数据从一个函数流动至另一个函数; 2. 数据结构需要贯穿多个函数; 3. 修改数据结构, 会在程序中造成连锁反应; 4. 数据完整性错误, 可能发生在多个函数, 出现bug, 不容易查找; 面向对象的设计方法是 设计对象, 主要改进: 1. 主要关注数据结构, 其次才是功能;

第 14 章 AOP(Aspect Oriented Programming)

  <?php interface Account{ public function hello($str); } class Demo implements Account{ public function __construct(){} public function hello($str = ""){ echo 'Hello: '.$str; } public function __destruct(){} } class Aop {     private $instan

第 21 章 NoSQL

21.1. MongoDB 21.1.1. pom.xml <dependency> <groupId>org.mongodb</groupId> <artifactId>mongodb-driver</artifactId> <version>3.2.2</version> </dependency> 21.1.2. 插入操作 package cn.netkiller.controller; import j

Python_基础知识储备

前言 前面的博文从记录了如何Setup Python开发环境,到IPython的基本使用.现在便由浅入深的学习Python编程艺术.学习一门编程语言,首先要了解其底层的实现机制和程序处理的过程,也就是了解其设计思想和解析实现.当然,初始一门语言,可以无须太过深入的去研究这些,但也要在心中建立起一个Python的知识框架,在接下来的学习过程中,不断的其填充和完善这一框架,有如造房筑楼. 初识Python Python 支持OOP(Object Oriented Programming面向对象编程实

Python OOP知识积累

前言 Python是一个功能非常强大的编程语言.玩法很多.但是在我们享受Python带来的编程乐趣之前,我们必须要掌握OOP编程技能,这样才能够更好的应用Python高级功能.OOP我曾经在<Python_基础知识储备>中提到过,这次我们再全面而详细的回炉一次. 对象 在计算机领域中,对象是人们要进行研究的任何事物,它表示具体的事物,此外也表示抽象的规则.计划或事件.对象是数据和操作数据的方法的结合. 对象的状态(数据):一个对象用数据值来描述它的状态,也称为对象属性. 对象的行为(操作):对

Overloading overriding runtime type and object orientation (1)

loading|object 6)Overloading overriding runtime type and object orientationObjective 1)State the benefits of encapsulation in object oriented design and write code that implements tightly encapsulated classes and the relationships "is a" and &qu