|
|
@ -1,7 +1,7 @@
|
|
|
|
use bson;
|
|
|
|
use bson;
|
|
|
|
|
|
|
|
|
|
|
|
use mongo_driver::CommandAndFindOptions;
|
|
|
|
use mongo_driver::CommandAndFindOptions;
|
|
|
|
use mongo_driver::collection::FindAndModifyOperation;
|
|
|
|
use mongo_driver::collection::{CountOptions,FindAndModifyOperation};
|
|
|
|
use mongo_driver::uri::Uri;
|
|
|
|
use mongo_driver::uri::Uri;
|
|
|
|
use mongo_driver::client::ClientPool;
|
|
|
|
use mongo_driver::client::ClientPool;
|
|
|
|
use mongo_driver::flags;
|
|
|
|
use mongo_driver::flags;
|
|
|
@ -59,6 +59,11 @@ fn test_mutation_and_finding() {
|
|
|
|
// Count the documents in the collection
|
|
|
|
// Count the documents in the collection
|
|
|
|
assert_eq!(2, collection.count(&query, None).unwrap());
|
|
|
|
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
|
|
|
|
// Find the documents
|
|
|
|
assert_eq!(
|
|
|
|
assert_eq!(
|
|
|
|
collection.find(&document, None).unwrap().next().unwrap().unwrap().get("key_1").unwrap().to_json(),
|
|
|
|
collection.find(&document, None).unwrap().next().unwrap().unwrap().get("key_1").unwrap().to_json(),
|
|
|
|