Commit 22a4628
authored
fix(GridFS): fix TypeError: doc.data.length is not a function (#1570)
This is a port of #1555 to 3.0.0 branch.
When using the promoteBuffers connect option, `doc.data` is already a node.js Buffer.
So trying to call `length()` like for `BSON.Binary` fails.
Fixed simply by checking `Buffer.isBuffer(doc.data)` type.1 parent 4ac475c commit 22a4628
1 file changed
+7
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
210 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
211 | 213 | | |
212 | 214 | | |
213 | 215 | | |
214 | 216 | | |
215 | 217 | | |
216 | 218 | | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
| 219 | + | |
221 | 220 | | |
222 | 221 | | |
223 | 222 | | |
224 | | - | |
| 223 | + | |
225 | 224 | | |
226 | | - | |
| 225 | + | |
227 | 226 | | |
228 | 227 | | |
229 | 228 | | |
230 | 229 | | |
231 | 230 | | |
232 | | - | |
233 | 231 | | |
234 | 232 | | |
235 | 233 | | |
| |||
241 | 239 | | |
242 | 240 | | |
243 | 241 | | |
244 | | - | |
| 242 | + | |
245 | 243 | | |
246 | 244 | | |
247 | 245 | | |
| |||
0 commit comments