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

  • SEARCH
  • Home
  • 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 7543829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:31:45+00:00 2026-05-30T08:31:45+00:00

I installed mongoose on node.js using npm. When I try to connect with this

  • 0

I installed mongoose on node.js using npm. When I try to connect with this code:

mongoose = require('mongoose/').Mongoose
@db = mongoose.connect("mongodb://localhost/test")

I get this error:

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
TypeError: Object function Mongoose() {
  this.connections = [];
  this.plugins = [];
  this.models = {};
  this.modelSchemas = {};
  this.options = {};
  this.createConnection(); // default connection
} has no method 'connect'
    at new ChatService (/home/lolcoder/workspace/sampleApp/src/services/dbService.js:12:26)
    at Object.<anonymous> (/home/lolcoder/workspace/sampleApp/src/app.js:40:17)
    at Object.<anonymous> (/home/lolcoder/workspace/sampleApp/src/app.js:44:4)
    at Module._compile (module.js:441:26)
    at Object..js (module.js:459:10)
    at Module.load (module.js:348:31)
    at Function._load (module.js:308:12)
    at Array.0 (module.js:479:10)
    at EventEmitter._tickCallback (node.js:192:40)

When do mongo in terminal, i get:

MongoDB shell version: 2.0.2
connecting to: test

Anyone knows why there is no connect() method in the mongoose object?

  • 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-05-30T08:31:46+00:00Added an answer on May 30, 2026 at 8:31 am

    Instead of

    mongoose = require('mongoose/').Mongoose;
    

    use

    mongoose = require('mongoose/');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm running node.js on OSX and have just installed mongodb using command npm install
just installed new ubuntu vm to test around with node installed things in this
I am try to set up an environment using Node.js and MongoDB on an
I installed subclipse in eclipse, but I get an error message Expected format '3'
I installed iplots and rjava packages. When I do this library(iplots), I get the
I'm having trouble getting mongodb and mongoose to install with npm. Any advice would
I installed virtualmin and phpmyadmin separately using the apt-get command. phpMyAdmin didn't work because
I installed Python 3.0 and now I can't get my code to work. Does
installed ejabberd using synaptic package manager on Ubuntu 10.04 without any error. sudo dpkg-reconfigure
I installed the wxWidgets source code, compiled it and am linking the libraries thus

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.