![]() In the example below, I called it “trigMovieLastUpdated.” Name the database trigger anything you want.Then click the “Add Triggers” button with the following settings: Now that our sample data is created, let’s create a simple database trigger as part of our use case for when a new document gets inserted into the “sample_mflix.movies” collection.Click on the “Collections” button that will take you to the Collections tab to see the sample databases that have been created:.This will take a few minutes, but it will populate your MongoDB Atlas with some sample datasets that we will use to build out the database trigger use case.In the main MongoDB Atlas screen, click the “.” ellipse button and then select “Load Sample Dataset.” Now that we have a free MongoDB Atlas cluster built, we can add some sample data to the cluster following these easy steps: Wait a few minutes and you will have a brand new MongoDB Atlas cluster built in the Cloud Provider and Region of your choosing. In this example, I am going to pick Azure Virginia-East2 (eastus2) and update the Cluster Name to be “DevCluster.” Then click “Create Cluster.” Start by clicking on the “Build Cluster” button and select the Free option. Once the initial setup is complete, it is time to build a free MongoDB cluster in a few easy steps. ![]() MongoDB Atlas provides a self-explanatory wizard to create the Organization, Project, and admin user components for the initial setup.The steps to create your MongoDB Atlas cluster in the Cloud are: Please see our triggers snippets for more ideas. However, there are endless possibilities for trigger usage to cover your specific use case. This is a simple example to showcase how easy it is to set up a trigger. That will update the “lastupdated” field on an insert of a new document in the “sample_mflix.movies” collection (which is part of the sample datasets provided by MongoDB). Then we’ll build out a use case using database DDL triggers. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |