Skip to main content
MongoDB Logo

MongoDB is a NoSQL database that uses JSON-like documents with optional schemas. The MongoDB Source Connector allows you to capture inserts, updates, and deletes from a collection and stream to a destination.

Adding Resource#

To add an MongoDB resource to your Meroxa Resource Catalog, you can run the following command:

meroxa resource add mongodb --type mongodb -u mongodb://$MONGO_USER:$MONGO_PASS@$MONGO_URL:$MONGO_PORT

The -u option requires a valid access URL.

Setup#

Environments#

The following MongoDB environments are supported:

Meroxa has been tested against the following MongoDB versions:

  • 3.4.x
  • 3.6.x
  • 4.0.x
  • 4.2.x

Networking#

To add as a resource, the MongoDB instance needs to be accessible by Meroxa.

If your instance is publically accessible, there is nothing to do. If not, you may:

Access URL#

The access URL contains the credentials needed to access your instance:

mongodb://$MONGO_USER:$MONGO_PASS@$MONGO_URL:$MONGO_PORT

In the example above, replace following variables with valid credentials from your MongoDB environment:

  • $MONGO_USER - MongoDB Username
  • $MONGO_PASS - MongoDB Password
  • $MONGO_URL - MongoDB URL
  • $MONGO_PORT - MongoDB Port (e.g., 1234).

Meroxa accepts any valid Mongo Connection String URIs.

Source Configuration#

The MongoDB Source Connector leverages the native oplog (as used internally within replica sets) to capture changes from a collection.

Creating Connectors#

The Input for this connector is an MongoDB Collection.

For example, to create a connector using the CLI, you may use the following command:

meroxa connector create from-mongo --from mongodb --input $MONGO_COLLECTION

Data Record#

On every update, the Data Record takes the following format:

{
"before": {
"id": 11,
"email": "ec@example.com",
"name": "Nell Abbott",
"birthday": "12/21/1959",
"createdAt": 1618255874536,
"updatedAt": 1618255874537
},
"after": {
"id": 11,
"email": "nell-abbott@example.com",
"name": "Nell Abbott",
"birthday": "12/21/1959",
"createdAt": 1618255874536,
"updatedAt": 1618255874537
},
"source": {
<information about sourc>
},
"op": "u",
"ts_ms": 1618255875392,
"transaction": null
}