0

When i try to import mongojs to connect to my mongodb,the webpack fails to compile and the following error is thrown.

Arun Prasanth.G
  • 51
  • 1
  • 1
  • 5
  • mongodb will work server side how you are doing at client side? You can look this repo for connection of mongodb at server side https://github.com/dhavalrajani92/react-redux-express – Dhaval Rajani Feb 26 '18 at 10:31

1 Answers1

0

Both mongodb and mongojs (tbh I have no idea why you would use mongojs over the official mongodb library) are Node libraries only and say that in the first sentence of the readmes, not for the web. Think about it - you wouldn't be connecting to your database directly and manipulating data from the client, that would be extremely insecure.

Dominic
  • 62,658
  • 20
  • 139
  • 163