marcello3d / node-mongolian

[project inactive] Mongolian DeadBeef is an awesome Mongo DB driver for node.js
https://groups.google.com/group/node-mongolian
zlib License
349 stars 50 forks source link

RFC - use mongo shell source js files directly #17

Closed AD7six closed 13 years ago

AD7six commented 13 years ago

Before finding this repo I started playing around with the idea of including only lightly modified files from https://github.com/mongodb/mongo/tree/master/shell

by lightly modified I mean for example appending this to the end of collection.js

module.exports.DBCollection = DBCollection;
module.exports.MapReduceResult = MapReduceResult;

and have something like this as the module index.js : https://gist.github.com/30ddac8c67a940c641ab

My current code is only a proof of concept (though you can load it, and get some semi-valid responses, it doesn't connect and therefore isn't useable - yet) but if I can get it to work at all I'll publish it and point at it :). My intention would be to have a node interface which is always up to date with the mongo-shell syntax and functionality.

As a project with a similar goal I wonder if you had also considered doing this, or if you have an opinion as to the viability of the general idea.

marcello3d commented 13 years ago

The primary issue with the mongo shell code is that it's all synchronous blocking calls. This makes using the source as-is pretty much impossible on Node.js. You'd have to use fibers or some other kind of pre-processing to make it node.js compatible.

Since the goals of the mongo shell (administration) are slightly different from Mongolian DeadBeef ([web]app development on node.js), Mongolian DB diverges where appropriate.

AD7six commented 13 years ago

thanks for the comment :)