Skip to main content

Posts

Showing posts with the label MongoDB

com.mongodb.MongoCommandException: Command failed with error 18: 'Authentication failed.' on server

If you are trying to connect Mongo DB Server and it insanely throwing following error. com.mongodb.MongoTimeoutException : Timed out after 1000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}. Client view of cluster state is {type=UNKNOWN, servers=[{address=192.168.1.10:27010, type=UNKNOWN, state=CONNECTING, exception={ com.mongodb.MongoSecurityException: Exception authenticating MongoCredential {mechanism=null, userName='user123', source='admin', password=<hidden>, mechanismProperties={}}}, caused by {com.mongodb.MongoCommandException: Command failed with error 18 : 'Authentication failed.' on server 192.168.1.10:27010 . The full response is { "ok" : 0.0, "code" : 18, "errmsg" : "Authentication failed." }}}] If you start looking the error content First you encounter with Timeout Exception which may mislead you. It is basically an authentication error. I...

How set up the environment and start MongoDB in Windows 7,8,10

Download the appropriate set up file from mongo db website.You can get it by simply searching on google. There are two method for set up the environments of the mongo db. First we need to click on to set-up file which you got by downloading from the mongo website. It will give some folder name in C:\ Program Files\MongoDB by default. Naive Method (Easy):     step-1  Create two nested folders in C drive like     C:\data\db     step-2 Navigate through C drive and MongoDB folder and open bin folder there must be two .exe       files mongod and mongo     step-3 Click on mongod.exe and it will open a window like cmd keep it opened.It starts the mongo     db server.     step-4 Now click mongo.exe it will also open a window. Now You can start executing your mongo     commands.     ex.   > show dbs; Professional Method: This method is for developer which has a...