Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 16, 2017

Conversation

guymguym
Copy link

@guymguym guymguym commented Oct 26, 2017

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
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