---
title: "NOSQL 之 Document Database 之 MongoDB"
author: "Wuaner"
date: "2013-03-21T18:11:25Z"
tags: ["Database", "MongoDB", "NoSQL", "document"]
categories: ["开源软件"]
slug: "nosql-document-database-mongodb"
draft: false
lastmod: "2013-03-22T17:41:50Z"
id: 1833642
url: "https://wuaner.iteye.com/blog/1833642"
---

Official siste:
<http://www.mongodb.org/>

MongoDB Manual Contents:
<http://docs.mongodb.org/manual/contents/>

Java relates( especially Java Language Center ):
<http://docs.mongodb.org/ecosystem/drivers/#java>

MongoDB API Docs for java:
<http://api.mongodb.org/java/>

Spring Data MongoDB - Reference Documentation:
<http://static.springsource.org/spring-data/data-mongodb/docs/current/reference/html/index.html>

The Little MongoDB Book： (即附件)
<http://openmymind.net/mongodb.pdf>
> To get started, there are six simple concepts we need to understand.
> 1. MongoDB has the same concept of a database with which you are likely already familiar (or a schema for you Oracle
> folks). Within a MongoDB instance you can have zero or more databases, each acting as high-level containers for
> everything else.
> 2. A database can have zero or more collections. A collection shares enough in common with a traditional table
> that you can safely think of the two as the same thing.
> 3. Collections are made up of zero or more documents. Again, a document can safely be thought of as a row.
> 4. A document is made up of one or more fields, which you can probably guess are a lot like columns.
> 5. Indexes in MongoDB function much like their RDBMS counterparts.
> 6. Cursors are different than the other five concepts but they are important enough, and often overlooked, that I
> think they are worthy of their own discussion. The important thing to understand about cursors is that when you
> ask MongoDB for data, it returns a cursor, which we can do things to, such as counting or skipping ahead, without
> actually pulling down data.



**与 RDBMS 对应关系：
collection vs. table, document vs. row and field vs. column**
<http://docs.mongodb.org/manual/reference/sql-comparison/>


MongonDB Shell:

```c

# 查看帮助；这个最有用！其他的大体都在里头
> help
# display current database
> db
# remove all documents from a collection, 注意只是删除该collection中的所有documents，并不删除该collection
> db.<collection_name>.remove()
# drop collection from the database，这个才是删除 collection，整个 collection，包括其中的 documents 和其对应的 indexes，都将被彻底删除，该 collection 在被 drop 后将不复存在
> db.<collection_name>.drop()

```