|
17 | 17 | //! Defining an example collection using derive.
|
18 | 18 | //!
|
19 | 19 | //! ```
|
| 20 | +//! # mod wrapper { |
20 | 21 | //! # use mongod_derive::{Bson, Mongo};
|
21 | 22 | //! #[derive(Bson, Mongo)]
|
22 | 23 | //! #[mongo(collection="users", field, filter, update)]
|
|
25 | 26 | //! age: Option<u32>,
|
26 | 27 | //! email: Option<String>,
|
27 | 28 | //! }
|
| 29 | +//! # } |
28 | 30 | //! ```
|
29 | 31 | //!
|
30 | 32 | //! ## Making requests
|
|
43 | 45 | //! Deleting a user from the users collection.
|
44 | 46 | //!
|
45 | 47 | //! ```no_run
|
| 48 | +//! # mod wrapper { |
46 | 49 | //! # use mongod_derive::{Bson, Mongo};
|
47 | 50 | //! # #[derive(Bson, Mongo)]
|
48 | 51 | //! # #[mongo(collection="users", field, filter, update)]
|
|
63 | 66 | //! println!("delete {} documents", deleted);
|
64 | 67 | //! # Ok(())
|
65 | 68 | //! # }
|
| 69 | +//! # } |
66 | 70 | //! ```
|
67 | 71 | //!
|
68 | 72 | //! ### Fetching
|
69 | 73 | //!
|
70 | 74 | //! Fetching users from the users collection.
|
71 | 75 | //!
|
72 | 76 | //! ```no_run
|
| 77 | +//! # mod wrapper { |
73 | 78 | //! # use std::convert::TryFrom;
|
74 | 79 | //! # use mongod_derive::{Bson, Mongo};
|
75 | 80 | //! use bson::Document;
|
|
95 | 100 | //! }
|
96 | 101 | //! # Ok(())
|
97 | 102 | //! # }
|
| 103 | +//! # } |
98 | 104 | //! ```
|
99 | 105 | //!
|
100 | 106 | //!T ### Inserting
|
101 | 107 | //!
|
102 | 108 | //! Inserting a user into the users collection.
|
103 | 109 | //!
|
104 | 110 | //! ```no_run
|
| 111 | +//! # mod wrapper { |
105 | 112 | //! # use mongod_derive::{Bson, Mongo};
|
106 | 113 | //! # #[derive(Debug, Bson, Mongo)]
|
107 | 114 | //! # #[mongo(collection="users", field, filter, update)]
|
|
123 | 130 | //! println!("(index: oid) {:?}", result);
|
124 | 131 | //! # Ok(())
|
125 | 132 | //! # }
|
| 133 | +//! # } |
126 | 134 | //! ```
|
127 | 135 | //!
|
128 | 136 | //! ### Replacing
|
129 | 137 | //!
|
130 | 138 | //! Replacing a user in the users collection.
|
131 | 139 | //!
|
132 | 140 | //! ```no_run
|
| 141 | +//! # mod wrapper { |
133 | 142 | //! # use mongod_derive::{Bson, Mongo};
|
134 | 143 | //! # #[derive(Debug, Bson, Mongo)]
|
135 | 144 | //! # #[mongo(collection="users", field, filter, update)]
|
|
156 | 165 | //! println!("{:?}", oid);
|
157 | 166 | //! # Ok(())
|
158 | 167 | //! # }
|
| 168 | +//! # } |
159 | 169 | //! ```
|
160 | 170 | //!
|
161 | 171 | //! ### Updating
|
162 | 172 | //!
|
163 | 173 | //! Updating a user in the users collection.
|
164 | 174 | //!
|
165 | 175 | //! ```no_run
|
| 176 | +//! # mod wrapper { |
166 | 177 | //! # use mongod_derive::{Bson, Mongo};
|
167 | 178 | //! # #[derive(Debug, Bson, Mongo)]
|
168 | 179 | //! # #[mongo(collection="users", field, filter, update)]
|
|
191 | 202 | //! println!("updated {} documents", updated);
|
192 | 203 | //! # Ok(())
|
193 | 204 | //! # }
|
| 205 | +//! # } |
194 | 206 | //! ```
|
195 | 207 | //!
|
196 | 208 | //! ## Optional Features
|
|
0 commit comments