Im Folgenden erhalten Sie einen kurzen Einstieg in das Mongo Management Studio und werden mit den wichtigsten Funktionen vertraut gemacht. Als Basis dient hierbei die lokale Version. Außerdem gehen wir davon aus, dass Sie Zugriff auf eine Mongo Datenbank haben. Wir verwenden die Collection zipcode als VorlageIn the following you get a short introduction to the Mongo Management Studio and will become familiar with the most important functions. The local version serves as the basis. In addition, we assume that you have access to a Mongo database. We use the collection zipcode as a template for our examples.
Installation
- Download the for your system required version of Mongo Management Studio
- Run the setup routine
- Start the application
Setting the English language
- Click the gear icon next to the button "Connect"
- It will open the application settings
- In the first selection box, select "English" as language
Connect
- Click on the button "Connect"
- Enter in the field "Server Connection" the connection data for your Mongo database (for example localhost)
- Click "Save and connect"
...
- Download the collection zipcode (http://media.mongodb.org/zips.json)
- Click with the right mouse button on the demo database and select Import documents
- Insert "zipcode" as name of the destination collection
- Drag the "zips.json" file in the field for the file upload
- Click the "Import"-button
...
- Click in the database "demo" on the collection "zipcode"
- Switch to table view
- Search for the city of CHESTER. For this enter following query in the search window
Codeblock | ||||
---|---|---|---|---|
| ||||
city: 'CHESTER' |
- Run the query by clicking on the "Run"-button or by the keyboard shortcut CMD + ENTER (MAC) or CTRL + ENTER (Windows / Linux)
- Sort the results by the column "pop" (population)
Edit a document
- Select a document and click the icon for "Edit document"
- Change the field "city" to "CHESTER123"
- Click "Save"
Create a document
- Click the button "Add document"
- Input the following record:
...
- Click "Save"
Querying with regex
- Search for all the cities containing 123
Codeblock | ||||
---|---|---|---|---|
| ||||
city: /123/ |
...
- Select "A" (aggregation) in the toolbar for an aggregation Framework query
- Enter the following query in the search window
Codeblock | ||||
---|---|---|---|---|
| ||||
{ $group: { _id : "$state", totalPop : { $sum : "$pop" } } }, { $match: { totalPop : { $gte : 10000000 } } } |
...
- Select "C" (console) in the toolbar for the console mode
- Enter the following query in the search window
Codeblock | ||||
---|---|---|---|---|
| ||||
db.zipcode.stats() |
...