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

Watch method fails when c# driver upgraded to 2.5 from 2.4

    • Type: Icon: Task Task
    • Resolution: Works as Designed
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.5
    • Component/s: API, Operations
    • Environment:
      Windows 10, Core i3 with 8GB RAM using Visual studio 2015 professional.

      Just after upgrading the c# driver to 2.5, my logic where I am using watch method to check for any updates on collection started failing with an error message.

      GetRequestChanges method failed with error : Command aggregate failed: Unrecognized pipeline stage name: '$changeStream'

      below is the code: and last line is where code breaks.
      {{var db = ConnectMongoDB();
      var options = new ChangeStreamOptions

      { FullDocument = ChangeStreamFullDocumentOption.UpdateLookup }

      ;
      var pipeline = new EmptyPipelineDefinition<ChangeStreamDocument<BsonDocument>>().Match(Builders<ChangeStreamDocument<BsonDocument>>.Filter.Empty);
      var col = db.GetCollection<BsonDocument>("tblRequest");
      var cursor = col.Watch(pipeline, options);}}

      In documentation, I do see the very first point says

      The 2.5.0 driver adds support for many of the new features introduced by the 3.6.0 server.

      Change streams
      The 2.5.0 driver adds support for change streams. See the Watch and WatchAsync methods in IMongoCollection.

      but here I don't see anything that suggests any changes.

      Can you suggest what's wrong here?

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            puneets Puneet Sharma
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: