mongodb基础

来源:互联网 发布:linux打开端口命令 编辑:程序博客网 时间:2024/05/22 00:04

MongoDB (from "humongous") is an open-source document database, and the leading NoSQL database. Written in C++

http://www.mongodb.org/downloads下载对应系统的文件直接使用,推荐linu 64位,解压出来可以直接使用

COMPONENTS
  bin/mongod - The database process.
  bin/mongos - Sharding controller.
  bin/mongo  - The database shell (uses interactive javascript).
UTILITIES
  bin/mongodump         - MongoDB dump tool - for backups, snapshots, etc..
  bin/mongorestore      - MongoDB restore a dump
  bin/mongoexport       - Export a single collection to test (JSON, CSV)
  bin/mongoimport       - Import from JSON or CSV
  bin/mongofiles        - Utility for putting and getting files from MongoDB GridFS
  bin/mongostat         - Show performance statistics

data files /var/lib/mongodb
log files /var/log/mongodb 


/etc/mongodb.conf
/var/lib/mongodb and /var/log/mongodb 


 /var/log/mongodb/mongod.log 
/etc/mongod.conf


./mongod --dbpath arg --logpath arg --port arg
./mongo --host arg --port arg -u arg -p arg
show dbs
use <db_name>
db
x = {}
db.<collection>.insert(x)
show collections
 system.indexes 
db.<collection>.find()
 _id 
var c = db.testData.find()
while ( c.hasNext() ) printjson( c.next() )
printjson( c [ 4 ]
db.testData.find( { x : 18 } )
db.testData.findOne()
db.testData.find().limit(3)
CRUD:
R:
limits, skips, and sort orders.
db.users.find( { age: { $gt: 18 } }, { name: 1, address: 1 } ).limit(5)


0 0
原创粉丝点击