microsoft / TypeScript-Node-Starter

A reference example for TypeScript and Node with a detailed README describing how to use the two together.
MIT License
11.31k stars 2.77k forks source link

MongoError: Invalid namespace specified '<database>.system.indexes' #241

Open AudriusMasiulionis opened 4 years ago

AudriusMasiulionis commented 4 years ago

Getting this error: UnhandledPromiseRejectionWarning: MongoError: Invalid namespace specified '.system.indexes' After npm start.

OS: windows 10 MongoDB server version: 4.2.0

TuanWorkMail commented 4 years ago

I also have that error

peterblazejewicz commented 4 years ago

Can you folks verify the db name in the connection string is valid one? The configuration file ships with template db name (MONGODB_URI_LOCAL=mongodb://localhost:27017/<database>). Verify you're on the latest version too and reinstalll NPM deps. I'll try to review this on the Windows (tried on mac OS)

HadiGolkarian commented 4 years ago

Can you folks verify the db name in the connection string is valid one? The configuration file ships with template db name (MONGODB_URI_LOCAL=mongodb://localhost:27017/<database>). Verify you're on the latest version too and reinstalll NPM deps. I'll try to review this on the Windows (tried on mac OS)

setting \<database> to something like test1 solved my issue

HoseinGhanbari commented 4 years ago

this can be closed, as the same issue can be fixed by replacing the entire <database> with dbname

MONGODB_URI_LOCAL=mongodb://localhost:27017/<database> MONGODB_URI_LOCAL=mongodb://localhost:27017/dbname

peterblazejewicz commented 4 years ago

@AudMasiulionis is that OK to close this one?

johnasterling commented 4 years ago

It would be nice to fix it so it works out of the box but that did fix it for me as @HoseinGhanbari said:

2020-06-04 running on windows with MongoDB installed to run as service, I needed to set the name to: dbname

MONGODB_URI_LOCAL=mongodb://localhost:27017/

MONGODB_URI_LOCAL=mongodb://localhost:27017/dbname

ligerno1 commented 3 years ago

in TypeScript-Node-Starter.env.example MONGODB_URI_LOCAL=mongodb://localhost:27017/

edit your dbname
mikereiche commented 2 years ago

I hit this running an older mongodb driver against a newer mongodb server. Using a new driver fixed the problem.

MongoError: Invalid namespace specified 'mydatabase.system.indexes'