0

I have used a connection statement similar to this before, without issue. But now I get a message TypeError:Mongoose.connect is not a function..

const mongoose = require('mongoose');

mongoose.connect("mongodb://localhost:27017/myDB");

What on earth does this mean, and why does it want a function?

ps: I reinstalled Mongoose with npm but it made no difference.

SunbeamRapier
  • 127
  • 2
  • 11
  • It might be that you're trying to require mongoose client-side. Possible duplicate of https://stackoverflow.com/questions/57944769/why-am-i-getting-mongoose-connect-is-not-a-function-when-trying-to-connect-wit – dalmo Aug 25 '20 at 05:17
  • I guess... the documentation is terrible. If Express is a prerequisite they should say so. I gave up on MongoDB and deleted it altogether... – SunbeamRapier Aug 25 '20 at 07:04

0 Answers0