Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9005493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:09:33+00:00 2026-06-16T01:09:33+00:00

I am trying to connect AngularJS with MongoDB using Mongoose. I would like to

  • 0

I am trying to connect AngularJS with MongoDB using Mongoose. I would like to pass the Models to be used by the Controllers, so I can $scope to the data. I am not sure if I have to go about setting up an Angular Service, if so, can you point me in the right direction. Thank You.

Overview:

Model:

var mongoose = require('mongoose');
var db = mongoose.createConnection('mongodb://localhost:3000/database');
var orderSchema = new mongoose.Schema({
    routeFrom : String,
    routeTo : String,
    leaving: String
});
var Order = db.model('Order', orderSchema);
module.exports = Order;

Controller:

// of course 'require' does not work but you get the idea
function OrderController($scope) {
  return $scope.orders = Order.find({});
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T01:09:35+00:00Added an answer on June 16, 2026 at 1:09 am

    You’ll need an interim step there. Going directly from Angular to Mongo will not work out. If you want a generic REST interface to Mongo with which you can utilize Angular’s bundled $http services, take a look at the list of REST services on Mongo’s site.

    Mongo REST Services

    http://www.mongodb.org/display/DOCS/Http+Interface#HttpInterface-RESTInterfaces

    Angular $http Service:

    http://docs.angularjs.org/api/ng.$http

    There’s a lot of different options here, but this is likely the easiest way to get up and going.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to connect with social web sites like facebook,twitter,linkedin etc using Hybridauth
I was trying to connect to MySQL using JAVA I used the same code
I am trying to connect to a MySQL Server using JDBC tool in java
I'm trying to connect to a FTP using Apaches FTPSClient but I keep getting
I'm using HostMonster as my web host and I'm trying connect to a database
When trying to connect to a .mdf databse in ASP.NET (using c#) I am
I am trying to connect to an edirectory v8.8 server running LDAP. How would
Im trying to connect to a server and than receive some data back in
I am trying to connect the siblings of the binary search tree. You can
I am trying to connect to my db via PDO like any other of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.