Mongodb learning (Set Operations + small vue)
Here, I first enter mongod--dbpath D: \ mongodbData to open the mongodb service.
Enter mongo 127.0.0.1: 27017/admin to open the client.
Next, I will perform the following operations:
1. delete a set:
Before deleting a collection, I first query all the data in the students collection.
Db. students. find () // query all data in the students set
Db. students. drop () // deletes a set, which is equivalent to deleting a table in mysql.
We can see that when I delete the set and query it again, there will be no data. Specifically, there is no feedback.
2. delete a database
Db. dropDatabase () // Delete the currently used database
After deleting a database through db. dropDatabase (), check the database in "show dbs" and find that the database has been deleted.
3. view the help command through db. help ()
If you cannot remember many commands during database operations at half past one, you can use "db. help ()" to view the help commands.
You can see that there are many such help documents when you enter db. help.
For example, you can use db. getName () to view the name of the currently used database, and use "db. getstats ()" to obtain the status of the current database.
At the same time, we can view the help documentation of the set through db. students. help.
4. Add set data using JavaScript
The mongodb client shell has a built-in JavaScript engine that can be used to execute js Code and methods. Next, I will write a method to add data to the students set, then, call this method.
We can see that when I call the "insert" method twice, I query the students set again and find that the data is indeed inserted.
MongoVue simple installation and use
First you need to go to the official website to download mongoVue: http://www.mongovue.com/downloads/
After the installation is complete, open and run the software. Note that the software is charged and can only be used for 13 days. Create a connection.
Click test to test whether the connection is successful.
Database, and students set data
Now, we will learn about the dedicated vue.