Don't use natural option in tail anymore

It's not supported anymore in MongoDB 3.4.
pull/33/head
Thijs Cadier 7 years ago
parent d7019099a2
commit 732d98ae4e

@ -706,14 +706,9 @@ impl<'a> Collection<'a> {
find_options: Option<CommandAndFindOptions>, find_options: Option<CommandAndFindOptions>,
tail_options: Option<TailOptions> tail_options: Option<TailOptions>
) -> TailingCursor<'a> { ) -> TailingCursor<'a> {
let query_with_options = doc! {
"$query" => query,
"$natural" => 1
};
TailingCursor::new( TailingCursor::new(
self, self,
query_with_options, query,
find_options.unwrap_or(CommandAndFindOptions::default()), find_options.unwrap_or(CommandAndFindOptions::default()),
tail_options.unwrap_or(TailOptions::default()) tail_options.unwrap_or(TailOptions::default())
) )

@ -50,7 +50,7 @@ fn test_tailing_cursor() {
// Try to tail on a normal collection // Try to tail on a normal collection
let failing_cursor = normal_collection.tail(doc!{}, None, None); 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()); assert!(failing_result.is_err());
let document = doc! { "key_1" => "Value 1" }; let document = doc! { "key_1" => "Value 1" };
@ -75,7 +75,7 @@ fn test_tailing_cursor() {
}); });
// Wait for the thread to boot up // 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 // Insert some more documents into the collection
for _ in 0..25 { for _ in 0..25 {
@ -85,5 +85,5 @@ fn test_tailing_cursor() {
// See if they appeared while iterating the cursor // See if they appeared while iterating the cursor
// The for loop returns whenever we get more than // The for loop returns whenever we get more than
// 15 results. // 15 results.
assert_eq!(25, guard.join().unwrap()); assert_eq!(25, guard.join().expect("Thread failed"));
} }

Loading…
Cancel
Save