Hi,
I’m trying to use the Kafka Connect MongoDB connector to sink data to CosmosDB with Mongo API.
When I create the connector, Connect returns an error immediately because the user doesn’t have the necessary privileges (insert, update, delete). However, it does have them, it’s just that CosmosDB seems to do something “peculiar” with Mongo RABC. For example, when running from Compass this:
Does anybody have any idea or suggestion to make this work? I’m thinking if a small contribution to the mongo-kafka project adding a config setting that allowed disabling this check would be considered at all.
I’m aware of that post, and also the fact that it is not up to date; CosmosDB launched support for Mongo API 4.2 in Feb '22 and the post is based on the feature set in August '21. Also, the post doesn’t mention anything about RABC. In any case, I do need to use CosmosDB so it doesn’t really matter.
Regarding asking a Microsoft forum, AFAIK it is the MongoDB community building the Kafka Connect connector, not Microsoft. I’m used to address open-source developers directly in Github and/or specific chats instead of general forums. I assume tor developers might monitor this forum, since it’s linked in the Github readme.
You are correct in asking on this forum as the engineers for the connector are here however the connector is designed and tested against a MongoDB instance not CosmosDB or any other third party MongoDB API. Can you use the native CosmosDB connector for Kafka in your solution ?
We tried that connector first. As you mentioned, being a native connector made it the perfect candidate. However, it is a bit more immature than we were hoping.
Considering how basic the scenario is, I didn’t feel me with confidence. I thought that MongoDB Connector would have seen more usage, be more polished and, assuming CosmosDB Mongo API lived up to its compatibility promise, a viable alternative.
To help set your expectations correctly: the Cosmos DB API for MongoDB is an independent implementation emulating a subset of MongoDB features for the associated server version. Cosmos’ native interface is their SQL/Core API, and there are emulated APIs supporting wire protocols and approximate feature mapping for MongoDB, Cassandra, and Gremlin.
These compatibility caveats may be fine for your use case, but you should not expect full compatibility as these are different codebases and underlying implementations.
I’ve also opened a PR that implements a config entry (skip.user.action.validation) so a developer can consciously force the connector (sink or source) to skip that check.
I’ve tested it with CosmosDB Mongo API and it works just fine. The fact that the connectionStatus command doesn’t return the user permissions doesn’t change that the user indeed has them and all reads/writes work. This is tested with the sink connector, though. I don’t have a use case for the source connector at the moment, but I would expect the same behaviour.
I hope that, even if this is not the main MongoDB backed by Atlas, since this connector is open-source, the contributors optimised for supporting as many people as possible and accept this contribution (happy to do corrections, my first contribution to the project).