MongoDB Common commands:
Switching between DBS with use Xxxdb
Then the operation is only for XXXDB;
Show DBS shows all databases
Show collections Display all collections
MongoDB database is generally installed under USR Local
./mongod--dbpath=/usr/local/mongodb/db--fork--logpath=/usr/local/mongodb/logs/1. Log
Enter the/usr/local/mongodb/bin directory to run./mongod Start MongoDB
Add various parameters behind MongoDB
For example:
Run./mongo The local database is connected by default and can be manipulated after entering the shell console mode
But start MongoDB to run in the background to add the--fork parameter
The parameters of other functions are remembered as double bars--
--dbpath--logpath LogPath parameter is followed by a directory plus a specific file or it will be an error
A common practice is to create a new mongodb.conf configuration file under the bin file
Configuration files are well configured.
dbpath=/usr/local/mongodb/dblogpath=/usr/local/mongodb/logs/mongodb.logport=27017 Fork=truenohttpinterface=true
Then set
Vi/etc/rc.d/rc.local
/usr/local/mongodb/bin/mongod--config/usr/local/mongodb/bin/mongodb.conf
You can turn it on and start.
MongoDB Use DB Show dbs