Uploaded image for project: 'Rust Driver'
  1. Rust Driver
  2. RUST-354

TailableAwait option doesn't seem to work in async driver

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 0.10.0
    • Affects Version/s: 1.0.0
    • Component/s: None

      I'm trying to use a tailable cursor on a capped collection.

      All documents in collection are read correctly and after that cursor is stuck and does not return new documents when they are inserted.

      Example code to reproduce the issue:

      ```

      use tokio::prelude::*;
      use mongodb::Client;
      use mongodb::options::{FindOptions, CursorType};
      use std::error::Error;
      use std::time::Duration;
      use futures::stream::StreamExt;

      #[tokio::main]
      async fn main() -> Result<(), Box<dyn Error>> {
      println!("Hello, world!");
      let client = Client::with_uri_str("mongodb://localhost:27017/").await?;

      let col_events = client.database("notifications").collection("events");

      let options = FindOptions::builder()
      .cursor_type(CursorType::TailableAwait)
      .max_await_time(Duration::from_secs(1))
      .build();
      let mut cursor = col_events.find(None, Some(options)).await?;

      while let Some(doc) = cursor.next().await

      { dbg!(doc); }

      println!("Done");
      Ok(())
      }

      ```

       

      I'm using unstable driver from:

      [[package]]
      name = "mongodb"
      version = "0.9.1"
      source = "git+https://github.com/mongodb/mongo-rust-driver#90925b9f2e68b9dcbefba6994d35345a5056867a"

       

      Related to #RUST-212

       

            Assignee:
            sam.rossi@mongodb.com Samuel Rossi (Inactive)
            Reporter:
            alexei.kornienko@gmail.com Alexei Kornienko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: