Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-2255

Unable to execute any Run Commands using C# Driver V2.5

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.5
    • Component/s: Command Operations
    • Environment:
      Windows 10, Framework 4.5.2, Visual Basic, MongoDB 3.4 database

      I'm unable to successfully execute any run commands using the new C Sharp driver. We previously used the C Sharp driver V1.1. Similar commands worked properly in that environment. In addition I'm also using the MongoDB Java driver V3.6.3. The exact same commands work properly via RunCommand.

      Here is the simplified VB source I'm using.
      Dim _oClient As MongoClient = Nothing
      Dim _oDatabase As MongoDatabase = Nothing
      Dim _oCommandResult As CommandResult = Nothing
      _oClient = New MongoClient("connstring")
      _oDatabase = _oClient.GetServer().GetDatabase(New MongoUrl("connstring").DatabaseName)
      Dim sCommand As String = "{aggregate:""restaurants"", pipeline:[{$group:{_id:""$borough"",borough:{$sum:1}}}]}"
      _oCommandResult = _oDatabase.RunCommand(sCommand)

      Here is the stacktrace that results. What is wrong? I get "no such command" messages no matter what syntax I try.

      Thanks in advance,
      Clifton Sothoron of Logi Analytics

      Command {aggregate:"restaurants", pipeline:[{$group:{_id:"$borough",borough:{$sum:1}}}]} failed: no such command: '{aggregate:"restaurants", pipeline:[{$group:{_id:"$borough",borough:{$sum:1}}}]}', bad cmd: '{ {aggregate:"restaurants", pipeline:[{$group:{_id:"$borough",borough:{$sum:1}}}]}: 1 }'.
      Source:
      MongoDB.Driver.Core
      Stack Trace:
      at MongoDB.Driver.Core.WireProtocol.CommandWireProtocol`1.ProcessReply(ConnectionId connectionId, ReplyMessage`1 reply) in C:\work\rstam\mongo-csharp-driver-v2.5.0\src\MongoDB.Driver.Core\Core\WireProtocol\CommandWireProtocol.cs:line 189

      at MongoDB.Driver.Core.WireProtocol.CommandWireProtocol`1.Execute(IConnection connection, CancellationToken cancellationToken) in C:\work\rstam\mongo-csharp-driver-v2.5.0\src\MongoDB.Driver.Core\Core\WireProtocol\CommandWireProtocol.cs:line 154

      at MongoDB.Driver.Core.Servers.Server.ServerChannel.ExecuteProtocol[TResult](IWireProtocol`1 protocol, CancellationToken cancellationToken) in C:\work\rstam\mongo-csharp-driver-v2.5.0\src\MongoDB.Driver.Core\Core\Servers\Server.cs:line 728

      at MongoDB.Driver.Core.Servers.Server.ServerChannel.Command[TResult](ICoreSession session, ReadPreference readPreference, DatabaseNamespace databaseNamespace, BsonDocument command, IElementNameValidator commandValidator, BsonDocument additionalOptions, Func`1 responseHandling, Boolean slaveOk, IBsonSerializer`1 resultSerializer, MessageEncoderSettings messageEncoderSettings, CancellationToken cancellationToken) in C:\work\rstam\mongo-csharp-driver-v2.5.0\src\MongoDB.Driver.Core\Core\Servers\Server.cs:line 362

      at MongoDB.Driver.Core.Operations.CommandOperationBase`1.ExecuteProtocol(IChannelHandle channel, ICoreSessionHandle session, ReadPreference readPreference, CancellationToken cancellationToken) in C:\work\rstam\mongo-csharp-driver-v2.5.0\src\MongoDB.Driver.Core\Core\Operations\CommandOperationBase.cs:line 152

      at MongoDB.Driver.Core.Operations.CommandOperationBase`1.ExecuteProtocol(IChannelSource channelSource, ICoreSessionHandle session, ReadPreference readPreference, CancellationToken cancellationToken) in C:\work\rstam\mongo-csharp-driver-v2.5.0\src\MongoDB.Driver.Core\Core\Operations\CommandOperationBase.cs:line 182

      at MongoDB.Driver.Core.Operations.WriteCommandOperation`1.Execute(IWriteBinding binding, CancellationToken cancellationToken) in C:\work\rstam\mongo-csharp-driver-v2.5.0\src\MongoDB.Driver.Core\Core\Operations\WriteCommandOperation.cs:line 57

      at MongoDB.Driver.OperationExecutor.ExecuteWriteOperation[TResult](IWriteBinding binding, IWriteOperation`1 operation, CancellationToken cancellationToken) in C:\work\rstam\mongo-csharp-driver-v2.5.0\src\MongoDB.Driver\OperationExecutor.cs:line 44

      at MongoDB.Driver.MongoDatabase.ExecuteWriteOperation[TResult](IClientSessionHandle session, IWriteOperation`1 operation) in C:\work\rstam\mongo-csharp-driver-v2.5.0\src\MongoDB.Driver.Legacy\MongoDatabase.cs:line 1052

      at MongoDB.Driver.MongoDatabase.RunCommandAs[TCommandResult](IClientSessionHandle session, IMongoCommand command, IBsonSerializer`1 resultSerializer, ReadPreference readPreference) in C:\work\rstam\mongo-csharp-driver-v2.5.0\src\MongoDB.Driver.Legacy\MongoDatabase.cs:line 1084

      at MongoDB.Driver.MongoDatabase.RunCommandAs[TCommandResult](IClientSessionHandle session, IMongoCommand command, ReadPreference readPreference) in C:\work\rstam\mongo-csharp-driver-v2.5.0\src\MongoDB.Driver.Legacy\MongoDatabase.cs:line 923

      at MongoDB.Driver.MongoDatabase.<>c_DisplayClass71_0`1.b_0(IClientSessionHandle session) in C:\work\rstam\mongo-csharp-driver-v2.5.0\src\MongoDB.Driver.Legacy\MongoDatabase.cs:line 913

      at MongoDB.Driver.MongoDatabase.UsingImplicitSession[TResult](Func`2 func) in C:\work\rstam\mongo-csharp-driver-v2.5.0\src\MongoDB.Driver.Legacy\MongoDatabase.cs:line 1110

      at rdServer.MongoDBReader.OpenConnection() in C:\ReportDev\VB\rdServer\DataEngine\DataReaders\MongoDBReader.vb:line 853

            Assignee:
            peter.garafano@mongodb.com Peter Garafano (Inactive)
            Reporter:
            cbsoth Clifton Sothoron
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: