[CSHARP-455] What happened to MongoServer.RunAdminCommand? Created: 27/Apr/12  Updated: 05/Apr/19  Resolved: 27/Apr/12

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 1.4.1
Fix Version/s: None

Type: Task Priority: Blocker - P1
Reporter: Kevin Baca Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: question
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

We're upgrading to csharp driver 1.4.1 from 1.3.1 and RunAdminCommand is gone. We're using RunAdminCommand to call "shardcollection".



 Comments   
Comment by Kevin Baca [ 27/Apr/12 ]

Thank you we'll try that.

Comment by Robert Stam [ 27/Apr/12 ]

A number of admin related commands were removed as part of the work related to supporting credentials when running with authentication. This was done to keep the number of overloads from growing out of control. It is discussed in the Release Notes for 1.4:

https://github.com/mongodb/mongo-csharp-driver/blob/master/Release%20Notes/Release%20Notes%20v1.4.md

You can make a simple change in your code. Where you might have been using:

var command = ... // code to create command
server.RunAdminCommand(command);

simply use this instead:

var command = ... // code to create command
var adminDatabase = server.GetDatabase("admin"); // provide admin credentials if needed
adminDatabase.RunCommand(command);

Generated at Wed Feb 07 21:36:53 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.