- This tutorial covers mac installation in MongoDB. This course covers the basics of working with MongoDB. Work your way through the videos/articles and I'll teach you everything you need to know to interact with Mongo's flexible document database management system and create powerful document databases!
- Free download MongoDB MongoDB for Mac OS X. MongoDB is an open-source document database, and the leading NoSQL database.
Mac OS Catalina 10.15.4 I installed the MongoDB server Community edition on my Mac without a problem (seemingly). I then installed MongoDB Compass community edition, from the MongoDB download cent.
“
Introduction
MongoDB Compass Community provides users a quick and easy way to execute a MongoDB document aggregation. Aggregation in MongoDB Compass Community is a simple and easy, but sophisticated, program that provides users with multiple MongoDB Compass options, including how to analyze documents and visualize and explore schemas to understand the types, ranges and frequency of fields in a data set. The Aggregation Pipeline Builder in MongoDB Compass Community offers the user the ability to create aggregation pipelines to process data so documents in a collection can pass through multiple stages where the documents are processed into a set of aggregated results, using the aggregate method in MongoDB Compass.
Prerequisite
![Download mongodb compass community edition Download mongodb compass community edition](https://www.percona.com/blog/wp-content/uploads/2018/06/MongoDB-Compass-300x200.jpg)
- Confirm that the MongoDB service is running.
- Confirm there is a working version of the MongoDB Compass application installed before proceeding.
Mongodb Compass Community Download Macromedia
NOTE: This tutorial uses the MongoDB Compass Community Edition version 1.18.0
The MongoDB Dataset
The following dataset will be used throughout this tutorial:
{'_id': ObjectId('5cee629f3fd48a38b2d163bd'),'name':'Chang Kai-shek','country':'China','rating':11} {'_id': ObjectId('5cee629f3fd48a38b2d163c1'),'name':'Cao Cao','country':'China','rating':19} {'_id': ObjectId('5cee629f3fd48a38b2d163c2'),'name':'Sun Tzu','country':'China','rating':10} {'_id': ObjectId('5cee629f3fd48a38b2d163bf'),'name':'Muammar al-Gaddafi','country':'Libya','rating':15} {'_id': ObjectId('5cee629f3fd48a38b2d163c0'),'name':'Oda Nobunaga','country':'Japan','rating':15} {'_id': ObjectId('5cee629f3fd48a38b2d163be'),'name':'Sun Yat-sen','country':'China','rating':8} |
Starting MongoDB Compass Community
Begin by opening MongoDB Compass and connecting to the database. The service will prompt the user for the host and a port number. This tutorial will work on localhost and will run MongoDB on the default port 27017. This will result in the program accepting all of the defaults so the user simply has to hit “Connect”.
NOTE: For more information on how to set-up databases in MongoDB Compass Community, refer to: How to Setup a Database in Compass Community
Once MongoDB Compass is connected to the MongoDB service it will prompt a window showing all databases in that specific connection.
How to Use the MongoDB Compass Community Aggregation Pipeline Builder
The MongoDB Compass Community tool is a useful feature that provides an easy way of developing a complex aggregation of pipeline queries.
For this demonstration, first select
warlordDatabase
, then warlordCollection
and then click the “Aggregations” tab from the menu. Here is the resulting image:Mongodb Compass Community Download Mac Os
To start the first stage of the aggregation, first click on “Select” from the drop-down list and then select
$match
. Compass will then ask the user to type in the desired expression. Below are the possible actions:
Value | Compass intellisense |
---|---|
[] | Compass requires array expression |
“ | Compass will list all fields associated with selected collection |
$ | Compass will show in a form of drop-down list all operators allowed within that particular operation |
The following example will execute a match for all instantiates of “warlord(s)” from the countries containing the alpha characters “Chi”:
Once the operation is completed on a particular stage the result will then be displayed on the right-hand side of the image. The below example shows that several documents were found:
Notice the information compass provided in the result pane stating “Output after $match stage(Sample of 4 documents)”.
To add another stage simply click the “Add Stage” button and then execute the same procedure with other operators, such as
$project
, $unwind
, $lookup
, etc.Once done withthe desired operation(s), the queries can be saved, retrieved and exported by clicking the “Save Pipeline” button, as shown here:
Conclusion
![Community Community](/uploads/1/1/8/5/118553429/445772984.png)
This tutorial demonstrated how aggregation in MongoDB Compass Community can provide users with multiple MongoDB Compass options, offering quick and easy ways to execute a MongoDB document aggregation and perform complex queries with the use of the Aggregation Pipeline Builder framework. When using the Aggregate Method in MongoDB Compass, users should bear in mind that the examples in this tutorial were executed with version 1.18.0 of MongoDB Compass Community. Results may differ from those in this tutorial if using other versions.
Nope you don't pixel67.
First off, when installing MongoDB from Brew, it will install it into: /usr/local/Cellar/mongodb/3.2.7/
The configuration file will be located in: /usr/local/etc/mongod.conf
If you open it up, you'll see that you db directory is specified:
systemLog:
destination: file
path: /usr/local/var/log/mongodb/mongo.log
logAppend: true
storage:
dbPath: /usr/local/var/mongodb
net:
bindIp: 127.0.0.1
Start MongoDB using your configuration file:
$ mongod --config /usr/local/etc/mongod.conf
Open a new terminal tab and connect to MongoDB:
$ mongo
The configuration file will be located in: /usr/local/etc/mongod.conf
If you open it up, you'll see that you db directory is specified:
systemLog:
destination: file
path: /usr/local/var/log/mongodb/mongo.log
logAppend: true
storage:
dbPath: /usr/local/var/mongodb
net:
bindIp: 127.0.0.1
Start MongoDB using your configuration file:
$ mongod --config /usr/local/etc/mongod.conf
Open a new terminal tab and connect to MongoDB:
$ mongo