Used by the likes of Netflix, Uber, and PayPal, Node.js is one of today’s hottest technologies. Its versatility, scalability, and event-handling abilities quickly earned applause (and heavy use) from developers worldwide.
Below are some highlights from their discussion. To listen to the full episode, check out the MongoDB Podcast here.
The successor to Node.js
“Why would we want to use Deno over a standard Node.js implementation?” Michael asks.
“By default it’s secure,” Jesse replies, especially in contrast to Node.js. “That is one of the big selling factors, because you have to specifically tell it to open your network in order to allow access to read or write files.”
In essence, Jesse explains, Deno is “set up to be the successor to Node.js.” As such, it includes a number of helpful features and attributes, such as blazing-fast speed (thanks to its Rust-based architecture), support for ES modules, and built-in asynchronous functions (removing the need to create your own).
Better package handling = increased efficiency
Deno also streamlines the development process in various ways — particularly when it concerns packages.
Unlike Node, which requires a NPM package manager, Deno simply “downloads [packages] globally and caches them,” Jesse says, removing the need for a Node modules folder in your project. Because Deno pulls packages in through URLs, this removes the bloat associated with having a Node modules folder in a project.
Michael wants to know if this affects development negatively — especially when it comes to offline development. Even if the files are located locally, surely Deno must require some sort of cached folder or module structure?
That’s not necessarily the case, Jesse replies. “You do have a local cache of those modules, and when you actually import them in the URL string, you can specify what version (if you wanted a different version).”
Deno x MongoDB
Of course, given that both Michael and Jesse work at MongoDB, the million-dollar question remains: compatibility. “What does the support for MongoDB look like in Deno?” Michael asks.
For now, Jesse explains, support comes in the form of third-party, community-supported modules only — specifically a Deno module called Mongo, easily accessible through the Deno website. As an alternative, Jesse suggests the MongoDB Atlas Data API, “which will allow you to bring your MongoDB data into basically anything, because it doesn’t require drivers at all.”