Use common commands in MongoDB

This example pipeline demonstrates how to use common MongoDB commands (Create, Insert, and Find) to create a collection, insert employee data, and retrieve the records.


MongoDB Execute Commands Example Pipeline

Configure the pipeline with three MongoDB Execute Snaps to perform the create, insert, and find operations. Each Snap in this pipeline performs the following operations:

  • Create employee details collection (collection indicates a table in MongoDB)
  • Insert the employee data into the collection
  • Retrieve the employee data
  1. Configure the Execute Snap with the create command to create a collection named employees_data with id, name, and salary fields.

    MongoDB Execute - Create collection configuration

  2. Configure the Execute Snap with the insert command to insert three records of employees (id:1, id:2, id:3) with their salary details.

    MongoDB Execute - Insert data configuration

  3. Configure the Execute Snap with the find command to retrieve the employee details.

    MongoDB Execute - Find data configuration

  4. Validate the pipeline.
    You can view the inserted records of the employees in the employee_data collection.
    MongoDB Execute output

To successfully reuse pipelines:
  1. Download and import the pipeline into SnapLogic.
  2. Configure Snap accounts as applicable.
  3. Provide pipeline parameters as applicable.