TypeScript-Node-Starter icon indicating copy to clipboard operation
TypeScript-Node-Starter copied to clipboard

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

Open AudriusMasiulionis opened this issue 6 years ago • 8 comments
trafficstars

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

OS: windows 10 MongoDB server version: 4.2.0

AudriusMasiulionis avatar Oct 15 '19 14:10 AudriusMasiulionis

I also have that error

TuanWorkMail avatar Oct 22 '19 07:10 TuanWorkMail

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)

peterblazejewicz avatar Oct 22 '19 20:10 peterblazejewicz

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

HadiGolkarian avatar Jan 26 '20 18:01 HadiGolkarian

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

HoseinGhanbari avatar May 08 '20 07:05 HoseinGhanbari

@AudMasiulionis is that OK to close this one?

peterblazejewicz avatar May 08 '20 16:05 peterblazejewicz

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

johnasterling avatar Jun 04 '20 20:06 johnasterling

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

ligerno1 avatar Jul 12 '21 06:07 ligerno1

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'

mikereiche avatar Jan 19 '22 17:01 mikereiche