Using a GeminiDB Mongo Trigger
This section describes how to create and configure a GeminiDB Mongo trigger for a function.
A function using a GeminiDB Mongo trigger will be triggered every time a database table is updated. For details about the GeminiDB Mongo event source, see Supported Event Sources.
Prerequisites
Before creating a trigger, ensure that you have prepared the following:
- You have created a function. For details, see Creating a Function from Scratch.
- You have enabled VPC access for the function. For details, see Configuring the Network.
- You have created a GeminiDB Mongo instance. For details, see Buying a Replica Set Instance.
Creating a GeminiDB Mongo Trigger
- Log in to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
- Click the function to be configured to go to the function details page.
- Choose Configuration > Triggers and click Create Trigger.
Figure 1 Creating a trigger
- Set the following parameters:
- Trigger Type: Select GeminiDB Mongo.
- GeminiDB Mongo Instance: Select a GeminiDB Mongo instance.
- Password: Enter the password of the GeminiDB Mongo instance administrator rwuser.
- Database: Enter the name of a GeminiDB Mongo database. Note that admin, local, and config are reserved database names and cannot be used here.
- Collection: Enter the name of a database collection.
- Batch Size: Set the number of records to be read from the database at a time.
- Click OK.
After VPC access is enabled, you need to configure corresponding subnet permissions for the GeminiDB Mongo security group. For details about how to configure VPC access, see Configuring the Network.
Configuring a GeminiDB Mongo Event to Trigger the Function
- Return to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
- Click the function to be configured to go to the function details page.
- On the function details page, select a version.
- On the Code tab page, click Test. The Configure Test Event dialog box is displayed.
- Set the parameters described in Table 1 and click Save.
Table 1 Test event information Parameter
Description
Configure Test Event
You can choose to create a test event or edit an existing one.
Use the default option Create new test event.
Event Template
Select GeminiDB Mongo.
Event Name
The event name can contain 1 to 25 characters and must start with a letter and end with a letter or digit. Only letters, digits, underscores (_), and hyphens (-) are allowed. For example, geminimongo-123test.
Event data
The system automatically loads the built-in GeminiDB Mongo event template, which is used in this example without modifications.
- Click Test. The function test result is displayed.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot