23

I installed mongoose using

sudo npm install -g mongoose

Please advice on how I can check to see if its installed properly. I am using Mac

6 Answers 6

46

To check if mongoose module is installed simply find the version by

npm list mongoose

To check globally

npm list -g  mongoose
3
  • Thanks, that worked and it returned the version, How do i start my mongo db server?
    – Amit
    Jun 18, 2014 at 5:44
  • probably late to the party but you can start the server through the terminal, using mongod.exe and mongo.exe respectively( in windows, of course)
    – aman
    Jul 3, 2016 at 17:31
  • So whenever I try to install mongoose, It says mongoose is installed, but as soon as I open a new instance of cmd, the query comes back up empty again... what am I doing wrong?
    – Flotolk
    Nov 20, 2017 at 14:57
16

Mongoose is a npm module. Mongodb may or may not be installed.

To check whether mongodb is installed:

which mongo

To install mongodb locally:

brew install mongodb

Then follow the post-installation instructions.

ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist

Test your connection to mongodb.

mongosh
0

If you are using MongoLab, to connect to database type: mongo

If you are running Mongo locally, start the Mongo daemon:

In the terminal type: mongod
If that doesnt run try: sudo mongod
Once mongoDB is running open another terminal window and type: mongo
In the same window type: show dbs
To work with a database in the list named myDB, for example type : use myDB

0

Two ways to check whether mongoose is install in your ubuntu/debian.

a) check locally( means into your project directory within node_modules)

For local - npm list mongoose

b) check globally( means in your OS within node_modules ).

For global check- npm list -g mongoose

It will show you the version of mongoose, if it already installed. If not then this will show this-

/home//.nvm/versions/node/v6.11.0/lib └── (empty) npm ERR! code 1

To install mongoose in ubuntu/debian, run this command in terminal - npm install --save mongoose

0

Also, if you used Homebrew you can check like:

mongod --version
mongos --version
mongosh --version

and for start(on Apple M1 chip) mongodb manually:

mongod --config /opt/homebrew/etc/mongod.conf --fork
mongosh

and for show the databases:

show dbs
-1

use npm list mongoose if mongoose is not installed you will get this respose `-- (empty)

Your Answer

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

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