Join the Stack Overflow Community
Stack Overflow is a community of 6.5 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I come from a LAMP stack background but lately I am been interested in Node.js/Angluarjs combo. Now I am wanting to get Mongodb into the mix but I am having the hardest time getting it set up. Every tutorial I find using a different kind of stack, some are using Express.js, others Mongoose, or something else. How do I go about using angularjs HTTP service to connect to Mongo? Do I need an intermediate library like Mongoose or can I do it directly with Angular. I had set this up a while back as an experiment. I am trying to do what I am doing in this page. In this, I am storing the data in a JSON file. I want to replace that JSON file with a connection to the Mongodb. I have MongoDb installed globally for Node and I have created a data collection through the console. You can see my experiment here - http://monkbunker.com/saas/#/ And the code for the http connection I have for this can be seen here starting on line 14 https://github.com/seanandersonmke/saas/blob/master/js/main.js

Is this similar to how I can work with MongoDB? How to set up an initial connection? I have sat down several times now for hours and ended up stumped every time. Please help. thanks.

share|improve this question
    
have you tried meanjs.org ? – Arūnas Smaliukas Jan 18 '15 at 19:09

Have a look on the following links:

Querying MongoDB with JSON / HTTP / REST Interface

Does MongoDB have a native REST interface?

There is a full python proxy solution: http://python-eve.org/

Maybe this is helpful for you.:)

share|improve this answer
    
Every time I follow documentation, I get some kind of error. For example, the official express docs have this - var express = require('express'); var app = express(); app.get('/', function(req, res){ res.send('hello world'); }); app.listen(3000); but right away I get an error "required is undefined"...that is just one example. – Sean Anderson Jan 18 '15 at 19:16
    
Also, I have been using Yeoman, trying to get basically a boilerplate app installed with all the dependencies but I ALWAYS get some sort of errors. Does, anyone have a simple code example for a very basic Mongodb connection...THAT WORKS? – Sean Anderson Jan 18 '15 at 19:19
    
One more thing...if you look at my code sample I posted, if can't take a whole lot of code to change that connection to mongodb instead of a JSON file. What could I add to that page to make it work? – Sean Anderson Jan 18 '15 at 19:22
    
@SeanAnderson How do you run your express code? is express installed? – apinnecke Jan 18 '15 at 19:35
1  
A lot of the errors I was having was solved by adding git to my Windows system path, which it apparently does not do automatically when installing in Node.js. Once I figure out how to get a connection to mongodb with angularjs, I will post my code. – Sean Anderson Jan 19 '15 at 23:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.