MongoDB Node.js Driver to use QuickJS interpreter to avoid having to install Node?

There is a easy to use, very lightweight, fully featured ES2020 interpreter called QuickJs.

I easily brought this library into my threaded web application (written in C++ using MongoCXX) and it gives my users the ability to write and execute their custom business logic in Javascript.

I see that node-js is available but requires you to install Node which I would like to avoid due to it’s large size and more unnecessary stuff to deal with.

I looked at the Node.js driver source and it is written in Typescript which I don’t understand although I have am familiar with Javascript.

Is there source code for Node.js driver in plain Javascript available?

My hope would be to use the Node.js driver mostly as is except for the parts that communicate with the server which I would have to adapt to the MongoDB C driver or to MongoCXX. Does this sound reasonable?

Also, I’m sure that there are many others who do not use Node and would prefer not having to install it if they really are not going to use it.

On a side note, I believe that QuickJs would be a perfect JS library to use with the Mongo shell instead of Spidermonkey. Spidermonkey has JIT but for the shell, I think that it is totally unnecessary, plus the size and complexity. I do believe that QuickJs would be way easier to use.

Online QuickJs demo:
Official website: QuickJS Javascript Engine
Github: GitHub - bellard/quickjs: Public repository of the QuickJS Javascript Engine. Pull requests are not accepted. Use the mailing list to submit patches.

Hopefully I’ll get some answers before deciding what to do next. I really would like to hear opinions on this, e.g. difficulty level, etc.

Here is an example that you can run yourself online (QuickJs).

Copy the following code below to a text file and upload to
The code below runs in about 175ms which demonstrates that JIT is not necessary for running reasonable business logic that shell or mongodb users would run (in my humble opinion).

const testFab = function() {
	const number = 200;
	let n1 = 0, n2 = 1, nextTerm;

	console.log('Fibonacci Series:');

	for (let i = 1; i <= number; i++) {
		nextTerm = n1 + n2;
		n1 = n2;
		n2 = nextTerm;

const testConcat = function(n) {
	let str = '';
	if (n != 0)
		str = str + '-' + n;
		str = n;

	return str;

let str = '';
for (n = 0; n < 100; ++n) {
	str += testConcat(n);

// start time
var start = new Date().getTime();

// run tests
console.log('Concatenation result:\n', str);

// end time
var end = new Date().getTime();
var time = end - start;
console.log('Execution time: ' + time + ' ms');

I’m familiar with QuickJS actually, and have looked into a similar scenario.

The main issue is no, there is not a JS version of the driver available, at least not in MongoDBs Public GitHub Repo anyway.

You would have to install Node.JS, and adapt things accordingly. I personally moved away from QuickJS myself because of issues discovered in its compatibility with other libraries and frameworks such as React.JS/React Native, Dart.JS, and a multitude of issues working with TailwindCSS and FlexBox.

I also had a multitude of issues with CloudFlare freaking out over it, as it kept flagging it as XSS was trying to take place. TBH you’d have much better success going to the Node Driver and running it through Atlas for server side, and running your clients via the Node.JS Realm SDK.


The reasoning behind the TypeScript FYI, was to build it out to be as universal to other JavaScript libraries etc as possible, as majority of JavaScript users (Like myself for instance) may know multiple libraries and frameworks from Next.JS, Node.JS, React.JS, Angular.JS etc. Or just one or two of them, but almost certainly everyone will be familiar with TypeScript.

Thanks Brock for your response, I’ve looked at a few online TS to JS converters and they seem to produce not very readable JS. Is this the nature of TS to JS conversions or is there a way to convert TS into easily readable JS, e.g. something that a person would write? Thanks again!

Unfortunately there isn’t, TS is just TS and a lot of translation service middleware is normally internally made from entity to entity, and will cause extreme performance issues.