From b536f1c0485abbec1f80e9de0a88ecbbd1b5f423 Mon Sep 17 00:00:00 2001 From: Thijs Cadier Date: Wed, 23 Sep 2015 14:29:31 +0200 Subject: [PATCH] Add test for count options --- tests/collection.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/collection.rs b/tests/collection.rs index d37df5b..8a8f317 100644 --- a/tests/collection.rs +++ b/tests/collection.rs @@ -1,7 +1,7 @@ use bson; use mongo_driver::CommandAndFindOptions; -use mongo_driver::collection::FindAndModifyOperation; +use mongo_driver::collection::{CountOptions,FindAndModifyOperation}; use mongo_driver::uri::Uri; use mongo_driver::client::ClientPool; use mongo_driver::flags; @@ -59,6 +59,11 @@ fn test_mutation_and_finding() { // Count the documents in the collection assert_eq!(2, collection.count(&query, None).unwrap()); + // Count with options set + let mut count_options = CountOptions::default(); + count_options.opts = Some(doc!{}); + assert_eq!(2, collection.count(&query, Some(&count_options)).unwrap()); + // Find the documents assert_eq!( collection.find(&document, None).unwrap().next().unwrap().unwrap().get("key_1").unwrap().to_json(),