NoSQL stands for 'not only SQL'.
并不是说完全不用到SQL的思想, 只是query的方式不同, 不需要用到传统的SQL query来进行数据的读取,还有一个很重要的特点是, NoSQL DB 不用到传统意义上的join 来进行table之间的结合,也当然就没有FK之类的概念, PK在NoSQL里面基本上是以hash key的形式存在 ( 在key-value以及document db中作为一个field -- _id存在)
现在主流的NoSQL数据库类型有四种:
a. Key-Value storage : Oracle NoSQL DB
b. Document Oriented Database: MongoDB, CouchDB
c. Wide-Column Store: Hadoop/HBase, Cassandra
d. Graph Database: Neo4j
在学习了lynda上的counchDB教程以后 (笔记详见板块里的记录), 今天阅读了一下MongoDB的官方指南 < The little MongoDB book>, 下面摘录了一下关于document store 的一些特点! 以MongoDB为例,(与counchDB有所不同)
Document oriented database: CouchDB, mongodb
I will be focusing on mongoDB as example. There are 6 main components in mongoDB
1. instance: one instance in mongoDB is made up of one or more databases.
2. database: The concept of 'database' is similar to the one used in
traditional relational database.
3. collections: one database is made up of one or more collections. And a
collection is made up of one or more documents. As a reference, you can think a collection as a table in traditional relational db.
4. document: one document is made up of several fields. one document could be
compared as one row in traditional relational database.
5. fileds: fileds could be compared as columns in table, but it doesn't
necessarily to be the same even within one table -- 'one document', which makes it more flexible than traditional db.
6. indexes: indexes in mongodb is similar with indexes in RDBMS
7. cursor: when you ask mongodb for data, it returns curosr, which could do a
lot of things without actually pulling out data, things include counting and skipping ahead. ( to be studied.)
不得不说对cursor和index的理解都不是很深入,需要再好好看一下,这里留个伏笔~
No comments:
Post a Comment