Mongo sharding cluster prompt: sharding not enabled for db xxx

I execute the first command:

db.runCommand({"enablesharding":"yuncaitest"})

Tip:

sharding already enabled for database yuncaitest

indicates that the sharding cluster has been enabled for this database.

when I set a collection as a sharding cluster, run the command:

db.runCommand({"shardcollection":"yuncaitest.aa","key":{"_id":"hashed"}})

Tip:

sharding not enabled for db yuncaitest

this in turn indicates that the database does not have a sharding cluster open.

what on earth is going on?

May.22,2021
Menu