MongoDB Error – Locked Out of Database Through Invariant() Failure

mongodbmongodb-3.0

I am trying to set up mongodb on my own server and connect to it remotely through my laptop.

I had successfully installed the database and created my own user with admin privileges. However, when I shutdown the server and restarted it, I try to run it through

mongod

and get

***aborting after invariant() failure

This error seems to be because I'm not passing in the correct credentials, but I cannot find any documentation on how to log in and start the instance using the new user I created. I've only found very old solutions through searching on my own that no longer seem to apply.

How do I connect to it, and then demand authorization from remote connections?

Best Answer

Deleting .ns file in data/db worked for me.

Invariant failure usually occurs if mongo is not been shut down properly, and improper shutdown will corrupt .ns (namespace that mongo creates for each database) file. So deleting .ns file will solve the issue.