Clean up orphaned documents in MongoDB error
OK.. 

Step 1. database and collection must be originally created (or sharded) thru mongoS

Step 2. command db.runCommand({cleanupOrphaned: "test.collection"}) must be ran on individual shard node (if replica set, then primary) at admin database. Not on mongoS, if you run that command on mongoS, you get that error message (and of course that error don't tell you that mongos cannot support that command).

#&gt;mlaunch init --sharded 2 --single
launching: mongod on port 27018
launching: mongod on port 27019
launching: config server on port 27020
replica set 'configRepl' initialized.
launching: mongos on port 27017
adding shards.

#&gt;mongo --port 27017
MongoDB shell version v3.4.6
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.6
MongoDB Enterprise mongos&gt; use test
switched to db test
MongoDB Enterprise mongos&gt; db.collection.insert({})
WriteResult({ "nInserted" : 1 })

#&gt; mongo --port 27018 
MongoDB shell version v3.4.6
connecting to: mongodb://127.0.0.1:27018/
MongoDB server version: 3.4.6
MongoDB &gt; use admin
switched to db admin
MongoDB &gt; db.runCommand( {cleanupOrphaned: "test.collection"})
{ "ok" : 1 }