Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-72473

Error about $_internalChangeStreamOplogMatch when trying to use $changeStream in a pipeline

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 6.0.3
    • Component/s: None
    • ALL
    • Hide

      Watch a collection with $changeStream in the pipeline.

      Show
      Watch a collection with $changeStream in the pipeline.

      I'm trying to watch a collection, but whenever $changeStream is part of the pipeline, I get the following error:

      Command failed (Location40602): $_internalChangeStreamOplogMatch is only valid as the first stage in a pipeline

      It doesn't matter what I set $changeStream to, or if it's alone or with other stages in the pipeline, I always get this error. I tried both with Rust and Node.js and I get the same error. This is the Rust code I'm using:

      let stream_pipeline = Some(doc! {
          "$changeStream" : {
              "fullDocument": "updateLookup"
      {{    }}}
      });
      {{}}

      let stream = collection.watch(stream_pipeline, None).await?;{}

      I'm using the "mongodb" 2.3.1 crate, Rust 1.66.0, MongoDB server 6.0.3, on macOS 13.1, Apple M1 Pro CPU. For Node.js I used the "mongodb" 4.13.0 package with Node.js 16.14.2.

            Assignee:
            Unassigned Unassigned
            Reporter:
            radu.dineiu@gmail.com Radu D
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: