Once done withthe desired operation(s), the queries can be saved, retrieved and exported by clicking the “Save Pipeline” button, as shown here: 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. Notice the information compass provided in the result pane stating “Output after $match stage(Sample of 4 documents)”. The below example shows that several documents were found: Once the operation is completed on a particular stage the result will then be displayed on the right-hand side of the image. The following example will execute a match for all instantiates of “warlord(s)” from the countries containing the alpha characters “Chi”: Below are the possible actions: ValueĬompass will list all fields associated with selected collectionĬompass will show in a form of drop-down list all operators allowed within that particular operation To start the first stage of the aggregation, first click on “Select” from the drop-down list and then select $match.Ĭompass will then ask the user to type in the desired expression. The MongoDB Compass Community tool is a useful feature that provides an easy way of developing a complex aggregation of pipeline queries.įor this demonstration, first select warlordDatabase, then warlordCollection and then click the “Aggregations” tab from the menu. How to Use the MongoDB Compass Community Aggregation Pipeline Builder Once MongoDB Compass is connected to the MongoDB service it will prompt a window showing all databases in that specific connection. NOTE: For more information on how to set-up databases in MongoDB Compass Community, refer to: How to Setup a Database in Compass Community This will result in the program accepting all of the defaults so the user simply has to hit “Connect”. This tutorial will work on localhost and will run MongoDB on the default port 27017. The service will prompt the user for the host and a port number. The following dataset will be used throughout this tutorial:īegin by opening MongoDB Compass and connecting to the database. NOTE: This tutorial uses the MongoDB Compass Community Edition version 1.18.0 The MongoDB Dataset PrerequisiteĬonfirm that the MongoDB service is running.Ĭonfirm there is a working version of the MongoDB Compass application installed before proceeding. 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. 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. MongoDB Compass Community provides users a quick and easy way to execute a MongoDB document aggregation.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |