microsoft / TypeScript-Node-Starter

A reference example for TypeScript and Node with a detailed README describing how to use the two together.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

AudriusMasiulionis opened this issue · comments

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

OS: windows 10
MongoDB server version: 4.2.0

I also have that error

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)

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

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

@AudMasiulionis is that OK to close this one?

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

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

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'