Skip to content

Commit e1582a7

Browse files
(DOCSP-25810): Output Cleanup (#41)
1 parent 4c5f61a commit e1582a7

33 files changed

+358
-352
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "mongo-cdc-sink",
3+
"config": {
4+
"connector.class": "com.mongodb.kafka.connect.MongoSinkConnector",
5+
"topics": "CDCTutorial.Source",
6+
"change.data.capture.handler": "com.mongodb.kafka.connect.sink.cdc.mongodb.ChangeStreamHandler",
7+
"connection.uri": "mongodb://mongo1",
8+
"database": "CDCTutorial",
9+
"collection": "Destination"
10+
}
11+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "mongo-cdc-source",
3+
"config": {
4+
"connector.class": "com.mongodb.kafka.connect.MongoSourceConnector",
5+
"connection.uri": "mongodb://mongo1",
6+
"database": "CDCTutorial",
7+
"collection": "Source"
8+
}
9+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"schema": { "type": "string", "optional": false },
3+
"payload": {
4+
"_id": { "_data": "8261...." },
5+
...
6+
"operationType": "delete",
7+
"clusterTime": { "$timestamp": { "t": 1631108282, "i": 1 } },
8+
"ns": { "db": "CDCTutorial", "coll": "Source" },
9+
"documentKey": { "_id": { "$oid": "6138..." } }
10+
}
11+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"schema": { "type": "string", "optional": false },
3+
"payload": {
4+
"_id": { "_data": "8260..." },
5+
"operationType": "insert",
6+
"clusterTime": { "$timestamp": { "t": 1611..., "i": 2 } },
7+
"wallTime": { "$date": "..." },
8+
"fullDocument": {
9+
"_id": { "$oid": "600b38ad..." },
10+
"proclaim": "Hello World!"
11+
},
12+
"ns": { "db": "CDCTutorial", "coll": "Source" },
13+
"documentKey": { "_id": { "$oid": "600b38a..." } }
14+
}
15+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Kafka topics:
2+
...
3+
The status of the connectors:
4+
5+
sink | mongo-cdc-sink | RUNNING | RUNNING | com.mongodb.kafka.connect.MongoSinkConnector
6+
source | mongo-cdc-source | RUNNING | RUNNING | com.mongodb.kafka.connect.MongoSourceConnector
7+
8+
Currently configured connectors
9+
10+
[
11+
"mongo-cdc-sink"
12+
"mongo-cdc-source"
13+
]
14+
...
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Kafka topics:
2+
...
3+
The status of the connectors:
4+
5+
source | mongo-cdc-source | RUNNING | RUNNING | com.mongodb.kafka.connect.MongoSourceConnector
6+
7+
Currently configured connectors
8+
9+
[
10+
"mongo-cdc-source"
11+
]
12+
...
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import pymongo
2+
from bson.json_util import dumps
3+
4+
client = pymongo.MongoClient('mongodb://mongo1')
5+
db = client.get_database(name='Tutorial1')
6+
with db.orders.watch() as stream:
7+
print('\nA change stream is open on the Tutorial1.orders namespace. Currently watching ...\n\n')
8+
for change in stream:
9+
print(dumps(change, indent = 2))
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"_id": {
3+
"_data": "826264..."
4+
},
5+
"operationType": "insert",
6+
"clusterTime": {
7+
"$timestamp": {
8+
"t": 1650754657,
9+
"i": 1
10+
}
11+
},
12+
"wallTime": {
13+
"$date": "2022-10-13T17:06:23.409Z"
14+
},
15+
"fullDocument": {
16+
"_id": {
17+
"$oid": "<_id value of document>"
18+
},
19+
"test": 1
20+
},
21+
"ns": {
22+
"db": "Tutorial1",
23+
"coll": "orders"
24+
},
25+
"documentKey": {
26+
"_id": {
27+
"$oid": "<_id value of document>"
28+
}
29+
}
30+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import pymongo
2+
from bson.json_util import dumps
3+
client = pymongo.MongoClient('mongodb://mongo1')
4+
db = client.get_database(name='Tutorial1')
5+
pipeline = [ { "$match": { "$and": [ { "fullDocument.type": "temp" }, { "fullDocument.value": { "$gte": 100 } } ] } } ]
6+
with db.sensors.watch(pipeline=pipeline) as stream:
7+
print('\nChange Stream is opened on the Tutorial1.sensors namespace. Currently watching for values > 100...\n\n')
8+
for change in stream:
9+
print(dumps(change, indent = 2))

source/includes/tutorials/docker-success.rst

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)