[CSHARP-4584] Command printShardingStatus failed: no such cmd: printShardingStatus Created: 27/Mar/23 Updated: 27/Oct/23 Resolved: 11/Apr/23 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Unknown |
| Reporter: | meng Alicia | Assignee: | Dmitry Lukyanov (Inactive) |
| Resolution: | Gone away | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
I want to get the collection shard key infomation and used the following code, whitch return error with "Command printShardingStatus failed: no such cmd: printShardingStatus" ``` using MongoDB.Driver; var client = new MongoClient("mongodb://reeeer:3*eefhu@124.9.75.107:8888,124.9.76.69:8888"); var database = client.GetDatabase("admin"); var command = new BsonDocument { {"printShardingStatus", 1}}; var result = database.RunCommand(command); // 输出结果 Console.WriteLine(result); ``` And the version of mongodb.driver is 2.19.0, the version of mongodb is 4.0.2; The account has administrator privileges; Dose the driver didn't support the printShardingStatus cmd or is there an error in my code?
|
| Comments |
| Comment by PM Bot [ 11/Apr/23 ] | |||||||||||||
|
There hasn't been any recent activity on this ticket, so we're resolving it. Thanks for reaching out! Please feel free to comment on this if you're able to provide more information. | |||||||||||||
| Comment by PM Bot [ 04/Apr/23 ] | |||||||||||||
|
Hey 961394844@qq.com, We need additional details to investigate the problem. If this is still an issue for you, please provide the requested information. | |||||||||||||
| Comment by Dmitry Lukyanov (Inactive) [ 27/Mar/23 ] | |||||||||||||
|
Hey 961394844@qq.com,
You can also inspect other server side sharding commands here. If you need exact response as from the "printShardingStatus" helper. You can analyze the shell javascript and implement similar logic in the driver. To get the shell javascript you can type the following in the shell:
where the code inside printShardingStatus itself can be get in the same way:
Proceeding with this approach and If you dive deeper into the printShardingStatus() function, you'll see it's just issuing find() on the config database along with some group() queries. |