From 732d98ae4ea569fe1aa0ca05a11e13c49a4f9556 Mon Sep 17 00:00:00 2001 From: Thijs Cadier Date: Fri, 18 Aug 2017 15:32:07 +0200 Subject: [PATCH] Don't use natural option in tail anymore It's not supported anymore in MongoDB 3.4. --- src/collection.rs | 7 +------ tests/cursor.rs | 6 +++--- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/collection.rs b/src/collection.rs index 2542fc0..72a50df 100644 --- a/src/collection.rs +++ b/src/collection.rs @@ -706,14 +706,9 @@ impl<'a> Collection<'a> { find_options: Option, tail_options: Option ) -> TailingCursor<'a> { - let query_with_options = doc! { - "$query" => query, - "$natural" => 1 - }; - TailingCursor::new( self, - query_with_options, + query, find_options.unwrap_or(CommandAndFindOptions::default()), tail_options.unwrap_or(TailOptions::default()) ) diff --git a/tests/cursor.rs b/tests/cursor.rs index ae495ef..f7b80d0 100644 --- a/tests/cursor.rs +++ b/tests/cursor.rs @@ -50,7 +50,7 @@ fn test_tailing_cursor() { // Try to tail on a normal collection let failing_cursor = normal_collection.tail(doc!{}, None, None); - let failing_result = failing_cursor.into_iter().next().unwrap(); + let failing_result = failing_cursor.into_iter().next().expect("Nothing in iterator"); assert!(failing_result.is_err()); let document = doc! { "key_1" => "Value 1" }; @@ -75,7 +75,7 @@ fn test_tailing_cursor() { }); // Wait for the thread to boot up - thread::sleep(Duration::from_millis(250)); + thread::sleep(Duration::from_secs(1)); // Insert some more documents into the collection for _ in 0..25 { @@ -85,5 +85,5 @@ fn test_tailing_cursor() { // See if they appeared while iterating the cursor // The for loop returns whenever we get more than // 15 results. - assert_eq!(25, guard.join().unwrap()); + assert_eq!(25, guard.join().expect("Thread failed")); }