码迷,mamicode.com
首页 > 数据库 > 详细

Mongodb

时间:2015-01-23 19:42:02      阅读:152      评论:0      收藏:0      [点我收藏+]

标签:

Collection

A collection is simply a grouping of documents that have the same or a similar purpose.

A collection is not enforced by a strict schema. Instead, documents in a collection can have a slightly different structure from one another, as needed. 

Document:

A document is a representation of a single entity of data in the MongoDB database.

The records in MongoDB that represent documents are stored as BSON, a lightweight binary form of JSON.

Write operations are atomic at the document level in MongoDB. 

If the update causes the document to grow to a size that exceeds the allocated space on disk, MongoDB must relocate that document to a new location on the disk. One way to mitigate document growth is to use normalized objects for properties that can grow frequently.

mongod:

This executable starts the MongoDB server and begins listening for database requests on the configured port.

To stop the MongoDB database from the shell client, use the following commands to switch to the admin database and then shut down the database engine:

use admin
db.shutdownServer()

http://docs.mongodb.org/manual/tutorial/recover-data-following-unexpected-shutdown/#clean-shutdown

If unclean shutdown is detected, delete the data/db/lock file, do mongod --dbpath C:/data/db --repair, then start mongod --dbpath C:/data/db.

By default httpinterface is off, to view localhost:28017 webpage, you need to start mongod with --httpinterface.

Shell

The MongoDB shell is an interactive JavaScript shell that is tightly coupled with the MongoDB data structure.

JavaScript:

JavaScript is a typeless language. You do not need to specify in the script what data type the variable is—the interpreter automatically figures out the correct data type for the variable. 

Define variables: var myString=‘yes‘;

Types: String, Number, Array, Object, Null

Manage db:

The admindatabase is a special database that provides additional functionality above normal databases.

http://techbus.safaribooksonline.com/book/databases/mongodb/9780133844429/part-i-getting-started-with-nosql-and-mongodb/ch01_html#X2ludGVybmFsX0h0bWxWaWV3P3htbGlkPTk3ODAxMzM4NDQ0MjklMkZjaDA0bGV2MXNlYzJfaHRtbCZxdWVyeT0=

Mongodb

标签:

原文地址:http://www.cnblogs.com/chayu3/p/4244778.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!