Why drop a collection command is not a parallel operation?

MongoDb Version :4.0.3 Community

I have a mongodb cluster with dozens shard, and the data size in each shard reach TB level, the “db.collection.drop” takes me hours to complete。

I found the drop command is a serial operation. Is there any possibility that this could be changed to parallel ?

for (const auto& shardEntry : allShards) {
        auto swShard = shardRegistry->getShard(opCtx, shardEntry.getName());
        if (!swShard.isOK()) {
            return swShard.getStatus();

        const auto& shard = swShard.getValue();

        auto swDropResult = shard->runCommandWithFixedRetryAttempts(

        if (!swDropResult.isOK()) {
            return swDropResult.getStatus().withContext(
                str::stream() << "Error dropping collection on shard " << shardEntry.getName());

        auto& dropResult = swDropResult.getValue();

        auto dropStatus = std::move(dropResult.commandStatus);
        auto wcStatus = std::move(dropResult.writeConcernStatus);
        if (!dropStatus.isOK() || !wcStatus.isOK()) {
            if (dropStatus.code() == ErrorCodes::NamespaceNotFound && wcStatus.isOK()) {
                // Generally getting NamespaceNotFound is okay to ignore as it simply means that
                // the collection has already been dropped or doesn't exist on this shard.
                // If, however, we get NamespaceNotFound but also have a write concern error then we
                // can't confirm whether the fact that the namespace doesn't exist is actually
                // committed.  Thus we must still fail on NamespaceNotFound if there is also a write
                // concern error. This can happen if we call drop, it succeeds but with a write
                // concern error, then we retry the drop.

            errors.emplace(shardEntry.getHost(), std::move(dropResult.response));

Hi @zhangruian1997 and welcome to the MongoDB Community forum!!

The MongoDB version you’ve mentioned is currently 4 yrs old and has reached end of life in April 2022. I would recommend you test & upgrade the sharded deployment to the latest versions for bug fixes and new features.

As per the server ticket, there have been a few bug fixes which have been made in the newer version.

If however, after the upgrade, if you are still facing issues, could you help me with some details about the deployment.

  1. Time the operation actually taking to completing?
  2. The size of the collection you are trying to drop.

Best Regards

Dear @Edward_Culllen,

I have flagged your post as SPAM. I have started to follow you to pickup your next attempt at spamming sooner.

Dear @Edward_Culllen,

it looks like you have not read my reply to one of your early post.

Congratulation for integrating your SPAM into a ChatGPT generated answer. Your post is not flagged as SPAM because I want other SPAM haters to know which iOS app developers in Atlanta to boycott.