GeminiDB Mongo Trigger
This section describes how to create a GeminiDB Mongo trigger on the FunctionGraph console. The trigger triggers a function each time a table in the GeminiDB Mongo is updated.
For details about the GeminiDB Mongo event source, see Supported Event Sources.
Notes and Constraints
- Currently, GeminiDB Mongo triggers are available in CN North-Beijing4, CN East-Shanghai1, and AP-Singapore. You can check whether the trigger type is supported on the console.
- The valid payload size of a request body is 6 MB when a GeminiDB Mongo trigger is used.
Prerequisites
- Function and configuration:
- You have created a function.
- You have configured the GeminiDB agency permission for the function. For details about how to create an agency, see Configuring Agency Permissions.
- You have enabled VPC access for the function. For details, see Configuring Networks.
- GeminiDB Mongo:
- You have created a GeminiDB Mongo instance. For details, see Buying a Replica Set Instance.
- You have configured the subnet permissions for the GeminiDB Mongo security group. For details, see .
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
- Configure the following parameters.
Table 1 Parameters of a GeminiDB trigger Parameter
Description
Example Value
Trigger Type
Mandatory.
Select GeminiDB Mongo.
GeminiDB Mongo
GeminiDB Mongo Instance
Mandatory.
Select a created GeminiDB Mongo instance. If no instance is available, click Create Instance.
geminidb-fg
Password
Mandatory.
Enter the password of the GeminiDB Mongo instance administrator rwuser.
GeminiDB@123
Database
Mandatory.
Set the database name. Note that admin, local, and config are reserved database names and cannot be used here.
GeminiDB-test
Collection
Mandatory.
Enter the database collection name.
GeminiDB-set
Batch Size
Mandatory.
Enter the number of records read from the database in each batch. The value ranges from 1 to 10000.
100
- Click OK.
Configuring a GeminiDB Mongo Event to Trigger the Function
- Return to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
- Click the name of the function to be configured. The function details page is displayed.
- 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 2 and click Save.
Table 2 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 Templates
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, Gemini-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.
Helpful Links
Manage function triggers through APIs. For details, see Function Trigger APIs.
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