Operational Defect Database

BugZero found this defect 962 days ago.

MongoDB | 1887075

Can't use Buffer in mongodb 3.6 js script

Last update date:

3/13/2024

Affected products:

MongoDB Server

Affected releases:

3.6.3

Fixed releases:

No fixed releases provided.

Description:

Info

Hi, I write a js script for mongodb 3.6.3 (Ubuntu 18.04) where I want to use js / nodejs "Buffer", but script execution says: E QUERY [thread1] ReferenceError: Buffer is not defined The minimal script where I can reproduce the issue is: let buff = new Buffer(10); buff[1] = 1; And the command line: mongo localhost:27017/dev minimal.js Can anybody help me, what did I wrong, or what am I miss? Thank you

Top User Comments

JIRAUSER1257066 commented on Mon, 18 Oct 2021 15:19:07 +0000: Hi moravas8051@gmail.com, We appreciate the update and are happy to hear that mongosh was able to resolve your issue! I will now close this ticket. Best, Edwin JIRAUSER1261191 commented on Mon, 18 Oct 2021 05:21:35 +0000: Hi Edwin Zhou, thank you for the help, after migrating to mongodb 5.0 and execute the script via mongosh the problem gone away. This is a sufficient solution for me. Note: executing the script via mongo command directly still fail on missing Buffer class. JIRAUSER1257066 commented on Fri, 15 Oct 2021 15:58:57 +0000: Hi moravas8051@gmail.com, We still need additional information to diagnose the problem. If this is still an issue for you, would you please let us know if you've found success using the Buffer class in mongosh? Best, Edwin JIRAUSER1257066 commented on Fri, 1 Oct 2021 16:53:46 +0000: Hi moravas8051@gmail.com, Thanks for your report. MongoDB 3.6 reached end of life in April 2021 and is no longer supported, but I can provide limit guidance on this issue. The new mongo Shell (mongosh) is a fully functional JavaScript and Node.js 14.x REPL environment for interacting with MongoDB deployments and the Buffer class is also functional when using mongosh. Please let us know if you're running into any issues using the new shell. Best, Edwin

Steps to Reproduce


Additional Resources / Links

Share:

BugZero® Risk Score

What's this?

Coming soon

Status

Closed

Learn More

Search:

...