0

I have a dedicated setup where nodejs is on one server and mongodb on a different server. The mongoose installation works and my app correctly handles mongo, so I do not have an issue per se.

My question is: Considering that mongoose builds a native C++ driver during npm install using the mongodb code, will I have less performance because mongoose installs differently when mongodb is unavailable?

The docs state that both HAVE to be installed.

P.S. I would like to avoid "polluting" my node server with a database service it does not need.

Thanks to eryone.

christophe
  • 25
  • 7

1 Answers1

2

You don't need to install mongodb on the server running your node app. The node-mongodb-native driver that's used by mongoose is a stand-alone javascript client library that allows your node app to connect to the mongodb server, issue commands, and retrieve responses. That server could be the same as your node server, or some other server on your network, or the internet.

Mongoose sits on top of the native node driver and provides the ability to define schemas and logic for your collections, but you can also access the native driver through mongoose to issue raw mongodb commands.

The mongoose NPM package includes the native driver, so you don't need to do anything beyond including the mongoose package with your app.

Brian Shamblen
  • 4,653
  • 1
  • 23
  • 37
  • Thanks Brian. That settles my question. Would you mind elaborating how this relates to what mongoose does with kerberos,bson and the c++ driver on rpm build? I've read several questions on SO but still do not get what mongoose needs to build on install. – christophe May 20 '15 at 20:24
  • It looks like there may be an issue with installing one of the dependent modules for mongoose on Windows, if that's what you're running into. Here is a link to the open issue on Github: https://github.com/Automattic/mongoose/issues/2362 – Brian Shamblen May 20 '15 at 20:38
  • Basically I am bitten by this: http://stackoverflow.com/questions/21656420/failed-to-load-c-bson-extension.Coupled with having no internet on webserver, so installing packages is problematic. I currently test npmbox. – christophe May 21 '15 at 09:46