Skip to main content

Striim Cloud 4.1.0 documentation

Mongo Cosmos DB Reader example application

The following application will read CDC data from Cosmos DB and write it to MongoDB.

CREATE APPLICATION MongoCosmosToMongo;

CREATE SOURCE MongoCosmosSrc USING MongoCosmosDBReader ( 
  CosmosDBConfig: '{\"Operations\": {\"SoftDelete\": {\"FieldName\" : \"IsDeleted\",\"FieldValue\" : \"true\"}}}', 
  Mode: 'Incremental', 
  Username: 'az-cosmos-mongodb', 
  ConnectionURL: 'az-cosmos-mongodb.mongo.cosmos.azure.com:10255', 
  Collections: 'testDB.collection$', 
  Password: '********' 
) 
OUTPUT TO cout;

CREATE TARGET MongoTarget USING MongoDBWriter ( 
  collections: 'src.emp,targdb.emp', 
  ConnectionURL: ******:27018', 
  Password: '******', 
  Username: 'myuser', 
  AuthDB: 'targdb', 
  upsertMode: 'true' 
) 
INPUT FROM cout;

END APPLICATION MongoCosmosToMongo;