MongoDB Sharding Collection

CloverETL Server 4.1.0
MongoDB 3.2.9
Driver Version (tried 3.2.2 and the clover default 2.13.2)

I am running a project where I need write to a dynamically generated (name differs each execution) collection in mongo some data that I need to shard (either before or after). I’m not trying to write or read any of the data after, but trying to shard the collection before or after the write operations fails with “Error: not connected to a mongos” even though I am running it on one of the shard servers.

I’ve tried the following in a MongoDBExecute task.
Connecting to dbName:
sh.shardCollection(“dbName.collectioName_TIMESTAMP”, {shardKey:1})

Connecting to admin:
db.runCommand( { shardCollection: “dbName.collectionName_TIMESTAMP”, key: { shardKey: 1 } } )

Running either of these commands in the mongo command line, connected to the mongos servers, result in success. Its just when I run this via Clover that I get the error.

Hi bgreenwood,

Our development team are currently working on a possible workaround for this issue. Also, they are working on making significant improvements to the MongoDB driver and service for our next CloverETL release which is 4.3.1.

Hi,
Have you Determine what you will use for the shard key.
If the collection already contains data you must create an index on the shard key using ensureIndex().
Enable sharding for a collection by issuing the sh.shardCollection() method in the mongo shell.