Skip to content

NODE-1168 promoteBuffers + GridFS = TypeError: doc.data.length is not a function - #1555

Merged
daprahamian merged 1 commit into
mongodb:2.2from
guymguym:patch-1
Nov 16, 2017
Merged

NODE-1168 promoteBuffers + GridFS = TypeError: doc.data.length is not a function#1555
daprahamian merged 1 commit into
mongodb:2.2from
guymguym:patch-1

Conversation

@guymguym

@guymguym guymguym commented Oct 26, 2017

Copy link
Copy Markdown

BUG: https://jira.mongodb.org/browse/NODE-1168

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.

Would love to get your review, and fix whatever is needed.

Thanks

… a function

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.
@guymguym

Copy link
Copy Markdown
Author

CI failure seems unrelated to me

@daprahamian
daprahamian merged commit 811de0c into mongodb:2.2 Nov 16, 2017
daprahamian added a commit that referenced this pull request Nov 16, 2017
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.
daprahamian added a commit that referenced this pull request Nov 17, 2017
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants