After a short essay, the installation of MongoDB can be done after the most basic database operation, the following steps to achieve your Hello world!
1. Open terminal Execution Brew services start MongoDB start MongoDB service, execute MONGO open shell operation;
2. Show All DB: show dbs
3. Enable a DB: Use mydb (if no mydb will automatically create this library)
4. Display the table in the library:Show Tables or show Collections (in MongoDB, table is called collection)
5. Insert a piece of data: db mycollection insertone ( { x : 1 Span class= "p" > ); (This table will be created automatically if not mycollection)
< Span class= "NX" >6. Query all the data in the table: db.mycollection.find () (all of MongoDB's data is stored in the form of a document (JSON) in collection < Span class= "NX" > ) /span>
7. Query all the data in the table, beautiful typesetting display:db.myCollection.find (). Pretty ()
8. Use tab code hint: input db.my click tab Key, will complete the code automatically; input db.mycollection.c click tab The key will prompt all fuzzy instructions, the manual knocking command completes.
9. Exit the shell operation: quit () or <control-C> shortcut key
MongoDB Learn the second---run the MONGO command through the Shell under Mac