@@ -39,7 +39,7 @@ use crate::{
3939/// ```rust
4040///
4141/// # #[cfg(not(feature = "sync"))]
42- /// # use mongodb::{Client, error::Result};
42+ /// # use mongodb::{bson::Document, Client, error::Result};
4343/// # #[cfg(feature = "async-std-runtime")]
4444/// # use async_std::task;
4545/// # #[cfg(feature = "tokio-runtime")]
@@ -55,7 +55,7 @@ use crate::{
5555/// let db_ref = db.clone();
5656///
5757/// task::spawn(async move {
58- /// let collection = db_ref.collection(&format!("coll{}", i));
58+ /// let collection = db_ref.collection::<Document> (&format!("coll{}", i));
5959///
6060/// // Do something with the collection
6161/// });
@@ -129,45 +129,26 @@ impl Database {
129129 self . inner . write_concern . as_ref ( )
130130 }
131131
132- /// Gets a handle to a collection specified by `name` of the database. The `Collection` options
133- /// (e.g. read preference and write concern) will default to those of the `Database`.
134- ///
135- /// This method does not send or receive anything across the wire to the database, so it can be
136- /// used repeatedly without incurring any costs from I/O.
137- pub fn collection ( & self , name : & str ) -> Collection {
138- Collection :: new ( self . clone ( ) , name, None )
139- }
140-
141132 /// Gets a handle to a collection with type `T` specified by `name` of the database. The
142133 /// `Collection` options (e.g. read preference and write concern) will default to those of the
143134 /// `Database`.
144135 ///
145136 /// This method does not send or receive anything across the wire to the database, so it can be
146137 /// used repeatedly without incurring any costs from I/O.
147- pub fn collection_with_type < T > ( & self , name : & str ) -> Collection < T >
138+ pub fn collection < T > ( & self , name : & str ) -> Collection < T >
148139 where
149140 T : Serialize + DeserializeOwned + Unpin + Debug ,
150141 {
151142 Collection :: new ( self . clone ( ) , name, None )
152143 }
153144
154- /// Gets a handle to a collection specified by `name` in the cluster the `Client` is connected
155- /// to. Operations done with this `Collection` will use the options specified by `options` by
156- /// default and will otherwise default to those of the `Database`.
157- ///
158- /// This method does not send or receive anything across the wire to the database, so it can be
159- /// used repeatedly without incurring any costs from I/O.
160- pub fn collection_with_options ( & self , name : & str , options : CollectionOptions ) -> Collection {
161- Collection :: new ( self . clone ( ) , name, Some ( options) )
162- }
163-
164145 /// Gets a handle to a collection with type `T` specified by `name` in the cluster the `Client`
165146 /// is connected to. Operations done with this `Collection` will use the options specified by
166147 /// `options` by default and will otherwise default to those of the `Database`.
167148 ///
168149 /// This method does not send or receive anything across the wire to the database, so it can be
169150 /// used repeatedly without incurring any costs from I/O.
170- pub fn collection_with_type_and_options < T > (
151+ pub fn collection_with_options < T > (
171152 & self ,
172153 name : & str ,
173154 options : CollectionOptions ,
@@ -213,7 +194,7 @@ impl Database {
213194 & self ,
214195 filter : impl Into < Option < Document > > ,
215196 options : impl Into < Option < ListCollectionsOptions > > ,
216- ) -> Result < Cursor > {
197+ ) -> Result < Cursor < Document > > {
217198 let list_collections = ListCollections :: new (
218199 self . name ( ) . to_string ( ) ,
219200 filter. into ( ) ,
@@ -234,7 +215,7 @@ impl Database {
234215 filter : impl Into < Option < Document > > ,
235216 options : impl Into < Option < ListCollectionsOptions > > ,
236217 session : & mut ClientSession ,
237- ) -> Result < SessionCursor > {
218+ ) -> Result < SessionCursor < Document > > {
238219 let list_collections = ListCollections :: new (
239220 self . name ( ) . to_string ( ) ,
240221 filter. into ( ) ,
@@ -392,7 +373,7 @@ impl Database {
392373 & self ,
393374 pipeline : impl IntoIterator < Item = Document > ,
394375 options : impl Into < Option < AggregateOptions > > ,
395- ) -> Result < Cursor > {
376+ ) -> Result < Cursor < Document > > {
396377 let mut options = options. into ( ) ;
397378 resolve_options ! (
398379 self ,
@@ -417,7 +398,7 @@ impl Database {
417398 pipeline : impl IntoIterator < Item = Document > ,
418399 options : impl Into < Option < AggregateOptions > > ,
419400 session : & mut ClientSession ,
420- ) -> Result < SessionCursor > {
401+ ) -> Result < SessionCursor < Document > > {
421402 let mut options = options. into ( ) ;
422403 resolve_options ! (
423404 self ,
0 commit comments