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

Aggregate Option Comment gives an error when doing an AggregateAsync

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.7.0
    • Component/s: Read Operations

      Hello

      When I do this:

      var options = new AggregateOptions

      { AllowDiskUse = true, Comment = "TESTE" }

      ;

       

      var match = ...

      var group = ...

      var stages = new BsonDocument[] {match, group};
      var pipeline = PipelineDefinition<BsonDocument,BsonDocument>.Create(stages);

      using (var cursor = await collection.AggregateAsync(pipeline, options))
      {
          while (await cursor.MoveNextAsync())
         

      {        }

      }

      I am getting an exception when I try to pass a comment as an aggregation option.

      The error is 

      Command aggregate failed: unrecognized field 'comment'.

      The stack trace of the exception is 

      at MongoDB.Driver.Core.WireProtocol.CommandUsingQueryMessageWireProtocol`1.ProcessReply(ConnectionId connectionId, ReplyMessage`1 reply)
      at MongoDB.Driver.Core.WireProtocol.CommandUsingQueryMessageWireProtocol`1.<ExecuteAsync>d__14.MoveNext()
      — End of stack trace from previous location where exception was thrown —
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at MongoDB.Driver.Core.Servers.Server.ServerChannel.<ExecuteProtocolAsync>d__29`1.MoveNext()
      — End of stack trace from previous location where exception was thrown —
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at MongoDB.Driver.Core.Operations.CommandOperationBase`1.<ExecuteProtocolAsync>d__28.MoveNext()
      — End of stack trace from previous location where exception was thrown —
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at MongoDB.Driver.Core.Operations.ReadCommandOperation`1.<ExecuteAsync>d__2.MoveNext()
      — End of stack trace from previous location where exception was thrown —
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at MongoDB.Driver.Core.Operations.AggregateOperation`1.<ExecuteAsync>d__55.MoveNext()
      — End of stack trace from previous location where exception was thrown —
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at MongoDB.Driver.OperationExecutor.<ExecuteReadOperationAsync>d__3`1.MoveNext()
      — End of stack trace from previous location where exception was thrown —
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at MongoDB.Driver.MongoCollectionImpl`1.<ExecuteReadOperationAsync>d__93`1.MoveNext()
      — End of stack trace from previous location where exception was thrown —
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at MongoDB.Driver.MongoCollectionImpl`1.<AggregateAsync>d__22`1.MoveNext()
      — End of stack trace from previous location where exception was thrown —
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at MongoDB.Driver.MongoCollectionImpl`1.<UsingImplicitSessionAsync>d__101`1.MoveNext()
      — End of stack trace from previous location where exception was thrown —
      at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
      at abc.Teste.<GetTeste>d__54.MoveNext() in 

       

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            rribeiro Rui Ribeiro
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: