1

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.

1

1 Answer 1

1

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.:)

Sign up to request clarification or add additional context in comments.

7 Comments

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.
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?
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?
@SeanAnderson How do you run your express code? is express installed?
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.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.