Add CommandAndFindOptions with_fields convenience method

pull/9/head
Thijs Cadier 9 years ago
parent d8669a4226
commit d6e9d823aa

@ -59,6 +59,17 @@ impl CommandAndFindOptions {
} }
} }
pub fn with_fields(fields: bson::Document) -> CommandAndFindOptions {
CommandAndFindOptions {
query_flags: flags::Flags::new(),
skip: 0,
limit: 0,
batch_size: 0,
fields: Some(fields),
read_prefs: None
}
}
fn fields_bsonc(&self) -> Option<bsonc::Bsonc> { fn fields_bsonc(&self) -> Option<bsonc::Bsonc> {
match self.fields { match self.fields {
Some(ref f) => Some(bsonc::Bsonc::from_document(f).unwrap()), Some(ref f) => Some(bsonc::Bsonc::from_document(f).unwrap()),

Loading…
Cancel
Save