0

I used Node.js / Express.js with MongoDB. Unfortunately, there were parts missing for me that kept me back from using Node.js

So I was wondering, could you list me some web development frameworks that natively support MongoDB? Whatever the programming langage it uses, I don't mind learning something new.

Thanks!

Community
  • 1
  • 1
Tommy B.
  • 3,591
  • 14
  • 61
  • 105
  • 2
    What were the problems you had with node.js and express? Were you using Mongoose at all? I've used these for a year in production and am curious to hear your experience. – Jamund Ferguson Mar 06 '12 at 17:53
  • You failed to mention Mongoose, were you using Mongoose? Also did you look at RailwaysJS which is an adpatation of Rails that leverages Mongoose and Express? – Gates VP Mar 07 '12 at 00:38
  • @GatesVP Yes I worked with Mongoose, which IMO is a bit too much of overhead for me since MongoJS is clear and simple to use. I don't like huge frameworks like Rails, and I don't think I'd like RailwaysJS so no I did not tried it. – Tommy B. Mar 07 '12 at 19:40
  • @JamundFerguson That's more of my personal problems then what Node.js can do. I had too much of OOP concepts in mind and tried to program in a way I shouldn't with Node.js, to be brief. – Tommy B. Mar 07 '12 at 19:41

3 Answers3

1

The only other web framework I personally know of that has built-in MongoDB support is Lithium, which is built in PHP.

Jamund Ferguson
  • 16,721
  • 3
  • 42
  • 50
1

Native support for mongoDB is easy. Use the native mongodb driver,

That's it. The web framework you use is unrelated to the database access.

Raynos
  • 166,823
  • 56
  • 351
  • 396
  • I meant built around MongoDB, that would provide more than what the driver has to offer. – Tommy B. Mar 06 '12 at 17:57
  • @Tom why do you want more then what the driver offers. The driver is ideal. – Raynos Mar 06 '12 at 17:59
  • The driver leaves a lot to be desired. First off it copies its syntax from the Ruby driver, which is completely different than the MongoDB JavaScript shell. Secondly, it doesn't make it particularly easy to open a connection and share it across a bunch of express routes, you have to write your own wrapper. Next, it doesn't provide any help at all for defaults or validation or schemas. Finally, the API is callback soup (too much so). Look at Mongoose, Mongolian, or Mongoskin IMO. – Jamund Ferguson Mar 06 '12 at 18:11
  • All of those abstractions are bloated nonsense. You don't want any of those. The driver API may not be ideal because it doesn't match the shell closely enough. [mongojs](https://github.com/gett/mongojs) solves that my wrapping mongo native and exposing an API that matches the mongo shell. As for opening a connection and sharing it, that's pretty easy to [write, just write it](https://gist.github.com/1946211), as for defaults, validation or schemas, meh. Mongo is schema less, validation is done at the user input/controller level, and defaults are trivial to implement. – Raynos Mar 06 '12 at 18:19
  • 2
    As for mongoose, mongolian and mongoskin, those are generic wrappers that expose a simple CRUD API and then get in the way of you developing your models like you want to. This means that they are inefficient since you don't take advantage of awesome things like findAndModify or upsert. And it also means that they force you into architecturing your database interaction in a certain fashion which is unlikely to assign with the rest of your project. Your better off writing this abstraction yourself, this means you understand the driver and have an abstraction layer with an API you like. – Raynos Mar 06 '12 at 18:21
  • You've both got really good points that makes me reconsider how I should build my next project. Could you both explain me how you develop your apps? (Which langage, framework, etc) – Tommy B. Mar 06 '12 at 18:26
  • 1
    @Tom [come talk to us ;)](http://chat.stackoverflow.com/rooms/642/node-js), personally I like low level APIs, I find express too complex for my liking but it's too useful and it's very good at just working and never getting in the way. My personal application architecture includes a summation of a large set of single reponsibility javascript libraries. [see dependencies](https://github.com/Raynos/raynos-blog/blob/master/package.json). I also use [nCore](https://github.com/Raynos/nCore) as a base library and I use my own libraries where needed – Raynos Mar 06 '12 at 18:47
  • @Raynos mongoskin has built-in findAndModify and in Mongoose you can drop to native by adding .collection to the model. findAndModify works in Mongoose exactly like it does in the native driver. – Jamund Ferguson Mar 06 '12 at 23:54
  • @Tom you should make a new post, saying "How should I structure my node/express/mongodb app" and I'd glady reply. – Jamund Ferguson Mar 06 '12 at 23:55
  • @JamundFerguson It was just an illustration that using abstractions for "easy CRUD" makes code inefficient. As for general conversation totally join chat.SO >_> – Raynos Mar 06 '12 at 23:59
  • @JamundFerguson http://stackoverflow.com/questions/9607947/how-should-i-structure-my-node-express-mongodb-app – Tommy B. Mar 07 '12 at 19:39
0

The framework with most momentum right now, that supports (only!) MongoDB natively, is meteor.js. Have a look at the screencast, it's awesome :)

Dan Dascalescu
  • 143,271
  • 52
  • 317
  • 404