I am a mongodb installed in CentOS1. Download MongoDBCurl-o http://downloads.mongodb.org/linux/mongodb-linux-x86_64-2.6.3.tgz2. Unzip the downloaded documentTAR-ZXVF mongodb-linux-x86_64-2.6.3.tgz3. Installing MongoDB
Cp-r mongodb-linux-x86_64-2.6.3/*/usr/local/mongo
Start MongoDB
The port for MongoDB successfully started is 27017
If you want to start the MongoDB input command in the background (use--fork to specify the--logpath parameter, establish log/in the MONGO directory)
./bin/mongod--dbpath=/data/db--fork--logpath=log/mongodb.log
simple operation of MongoDB
Enable a window to switch to the MONGO directory
Type./bin/mongo Use the MongoDB default client to manipulate data
1.help--mongo Help
2.show DBS; --View all databases
3.show collections; --Displays the collection in the current database (similar to a table in a relational database)
4.use dbname;--Switch database
5.db.getname (); --View the current database name
6.db.stats (); --Displays the current DB status
7. Db.getmongo (); --View the link machine address of the current DB
Collection Aggregation Collection
1. Create a Clustered collection (table)
Db.createcollection ("Collname", {size:20, Capped:5, max:100});
2. Get a clustered collection with the specified name (table)
Db.getcollection ("account");
3. Get all the aggregation sets for the current DB
Db.getcollectionnames ();
4. Displays the status of all clustered indexes in the current DB
Db.printcollectionstats ();
MongoDB Installation and Basic commands