[CSHARP-1713] Need Powershell to access mongodb v3.x Created: 18/Jul/16 Updated: 05/Apr/19 Resolved: 18/Aug/16 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | Connectivity |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Ross Jurek | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | question | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
I had a powershell script that was access mongodb 2.x with the csharpdriver 1.7 from 10gen, now the mongodb is v3.x and the script is failing on credentials, I have upgraded to the latest csharpdriver and still can not gain access to the v3.x version of mongodb |
| Comments |
| Comment by Craig Wilson [ 20/Jul/16 ] | ||
|
I'm not a powershell guru, so you're gonna have to work through this a bit on your own I'm afraid. Here is the API documentation for the class: http://api.mongodb.com/csharp/2.2/html/T_MongoDB_Driver_MongoClientExtensions.htm. I've likely made a mistake in my powershell syntax. I'd be great to use the new API instead, but it's full of generics and I seem to recall that powershell doesn't play with generics very well. Craig | ||
| Comment by Ross Jurek [ 19/Jul/16 ] | ||
|
I get an error that MongoClientExtensions does not exist. | ||
| Comment by Craig Wilson [ 18/Jul/16 ] | ||
|
Ross, I think if you add
before
Your code should continue to work. In the new API, GetCollection is a generic method. If you'd like to see better support for powershell from the .NET Driver team, please create a new ticket with the request. So far, there hasn't been a whole lot of interest. Craig | ||
| Comment by Ross Jurek [ 18/Jul/16 ] | ||
|
------ driver 1.7 from 10gen, mongo 2.6 - This code gives a credential error when changing to the 3.2.1 mongodb use old driver, changed to new driver, error that create method does not exist. ------ 2.6 csharpdriver, mongodb 3.2.1 - get Cannot find an overload for "GetCollection" and the argument count: "1". $mongoDbDriverPath = "C:\utilities\mongoDB_2\" $database = $client.GetDatabase($dbName) $query = [MongoDB.Driver.Builders.Query]::AND( $results = $collection.find($query) | ||
| Comment by Craig Wilson [ 18/Jul/16 ] | ||
|
Hi Ross, Sorry you are having some trouble. In order to help, we need to see your script. I'd also like to know exactly what version of MongoDB you were running and exactly what version of MongoDB you are now running. In addition, I need to know the exact version of the driver you are unable to connect with. Craig |