MongoDB Common commands:
Talk about a special situation, if the admin uses encryption, then you create a database must be encrypted to use, this is the problem I personally met.
Enter the MongoDB command line, note: The default entry is the test library $ mongo// admin is the core group of database management, the total permissions console, stored the user name password role and other information. Create a database, note: If the admin encryption, local login please first use username and password login admin in use// Local login admin, first exit to System command line: $ mongo admin -- Username= User name --password= password, then create the database using the following command > use youDatabase;// switch the database, and create the same command, Note: If the admin is encrypted, you must encrypt the created database > use dbName// encrypt the dbName, note: Version 3.0 with Db.createuser (' sa ', ' sa ') or Db.createuser ({User: ' sa ', pwd: ' sa ', roles:[', ']}); > db.adduser (' sa ', ' sa ');// last another row of data authentication, the Safe Mode command only takes effect > db.auth (' sa ', ' sa ');//return 1 succeeded// The encryption is deleted > db.removeuser (' sa ');// to delete the database first use dbname to a > db.dropdatabase ();// See what databases you have, first > use admin;// then > show dbs;// View all collections, using > show under the current database collections;// Insert > db.users.insert ({name: ' Test '});// view all > db.users.find ();// View a > db.user.findone ({_id:objectid (' 555DA6FBE19260407BE9EFBD ')});// What's down there? UPDATE&NBSp;,remove Delete a document, much the same// to delete a collection, under the current Database > db.users.drop ();// View the current database name > db.getname ();// View database version > db.version ();// View the host address of the currently connected database > db.getmongo ();// Show of course db status Condition > Db.stats ();// There's so much more.
MongoDB Remote Connection
$ mongo-u User name-p password IP address: 27017/dbname//Note: to the upper port good is the database default, you are what is what
MongoDB permissions, basic commands