Ingest data from MongoDB CDC
This topic walks you through the steps to ingest change streams from MongoDB to RisingWave using the built-in connector.
Notes about running RisingWave from binaries
If you are running RisingWave locally from binaries and intend to use the native CDC source connectors or the JDBC sink connector, make sure that you have JDK 11 or later versions installed in your environment.
Create a table in RisingWave using the native CDC connector
Syntax
Connector parameters
Unless specified otherwise, the fields listed are required. Note that the value of these parameters should be enclosed in single quotation marks.
Field | Notes |
---|---|
mongodb.url | The connection string of MongoDB. |
collection.name | The collection or collections you want to ingest data from. Use the format db_name.collection_name to specify which database the collection is in. To ingest data from collections in different database, use a comma-separated list of regular expressions. |
Regarding the INCLUDE timestamp AS column_name
clause, it allows you to ingest the upstream commit timestamp. For historical data, the commit timestamp will be set to 1970-01-01 00:00:00+00:00
. Here is an example:
You can see the INCLUDE clause for more details.
Metadata options
Field | Notes |
---|---|
database_name | Name of the database. |
collection_name | Name of the MongoDB collection. |
Examples
The following SQL query creates a table that ingests data from all collections in the dev
database.
The following SQL query creates a table that ingests data from all collections in the databases db1
and db2
.
Was this page helpful?