Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node.js module for MongoDB [closed]

Tags:

There are several MongoDB modules available for Node.js in the following link - https://github.com/joyent/node/wiki/modules#wiki-db-nosql-mongo

Please, suggest me one (I'd like to know why you choose that one?).

like image 645
Rifat Avatar asked Oct 02 '11 16:10

Rifat


1 Answers

It depends on what level of abstraction you want from your data. If you want something similar to an ORM, then Mongoose is the obvious choice and is popular.

However, the node-mongodb-native driver gives you clean duplication of almost the entire MongoDB API and since BSON is translated to JSON and JavaScript is a flexible dynamic language, there's really no need for an ORM. The latter does have benefits such a defining a schema which helps with validation and other tasks, but it also limits your flexibility.

Mongoskin is built atop node-mongodb-native but gives you the ability to have additional JavaScript method bindings and deal with connections and cursors easier. It's pretty lightweight, so you can stick with the basics or do more. This library is my personal preference and our team has built our own tooling and validation system around it.

like image 189
Chris F Avatar answered Sep 21 '22 20:09

Chris F