I am not able to connect to MongoDB Atlas with below error.Using plugin version 3.1.7.
[WARN ][logstash.outputs.mongodb ][main] MONGODB | Failed to handshake with : 27017 ArgumentError: wrong number of
arguments (given 2, expected 1)
[WARN ][logstash.outputs.mongodb ][main] MONGODB | Error checking
:27017: ArgumentError: wrong number of arguments (given
2, expected 1)
Mongodb url is "mongodb+srv://username:password#clustername.mongodb.net/dbname?retryWrites=true&w=majority"
I see, the version has fix 1 for the same issue. Am I missing anything?
Related
When I am inserting data in MongoDb database using cmd command
mongo mongodb://localhost:27017/DummyDatabase --eval "db.Dummy.insert({a:12345,b:asd})"
I am getting following error -
MongoDB shell version v4.2.0
connecting to: mongodb://localhost:27017/Ontologies?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("6da84ed8-8bf0-4a6c-9d38-7c70cbfc8c7e") }
MongoDB server version: 4.2.0
2019-11-07T13:49:15.316+0530 E QUERY [js] uncaught exception: ReferenceError: asd is not defined :
#(shell eval):1:38
2019-11-07T13:49:15.320+0530 E - [main] exiting with code -4
But when I give this command -
mongo mongodb://localhost:27017/DummyDatabase --eval "db.Dummy.insert({a:12345})"
This works, what can be the issue?
The issue with failing command is that the value provided to the field with key 'b' is not a legal JSON value type. asd is a string that needs to be enclosed in quotes so that the document being inserted can be a valid JSON object. Refer to json.org for details.
I have a MongoDB cluster running MongoDB 3.4.14 in MongoDB Atlas. My application is successfully connected with this cluster and can read and write. I can connect with the shell to this cluster also.
When I try to connect with Studio3t (Version 2018.2.5) everything works fine as well. But when I try to view an available collection I get the following error:
Failed to retrieve documents
[somedatabase.somecollection#SomeCluster [replica set]] Database error!
Stacktrace:
|_/ java.lang.Exception: [somedatabase.somecollection#SomeCluster [replica
set]] Database error!
|____/ Mongo Server error (MongoQueryException): Query failed with error code 59 and error message 'command not found' on server cluster0-shard-00-00-*****.mongodb.net:27017
I'm not sure if this is a problem with the cluster configuration or with Studio3t itself.
If I can provide you with more information that would help to solve the problem just let me know.
I tried to much posibilities that I found searching for this error without success.
I can connect to my mongo with the CLI typing mongo --port myPort -u myUser ...
But I need to connect my app (in the same host) by URI.
This is what I get:
mongo mongodb://username:password#localhost:myPort/myDb
MongoDB shell version: 2.6.10
connecting to: mongodb://username:password#localhost:myPort/myDb
2017-05-19T23:34:33.568+0200 Assertion failure _setName.size() src/mongo/client/dbclientinterface.h 231
2017-05-19T23:34:33.569+0200 0x6b75c9 0x659e9f 0x636a32 0x5013b8 0x4fa7f1 0x6006fd 0x5eb869 0x7fdcdff35d76 0x1ebf47506362
mongo(_ZN5mongo15printStackTraceERSo+0x39) [0x6b75c9]
mongo(_ZN5mongo10logContextEPKc+0x21f) [0x659e9f]
mongo(_ZN5mongo12verifyFailedEPKcS1_j+0x142) [0x636a32]
mongo(_ZN5mongo16ConnectionStringC1ENS0_14ConnectionTypeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_+0x208) [0x5013b8]
mongo(_ZN5mongo16ConnectionString5parseERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERS6_+0x201) [0x4fa7f1]
mongo(_ZN5mongo17mongoConsExternalEPNS_7V8ScopeERKN2v89ArgumentsE+0x11d) [0x6006fd]
mongo(_ZN5mongo7V8Scope10v8CallbackERKN2v89ArgumentsE+0xa9) [0x5eb869]
/usr/lib/libv8.so.3.14.5(+0x99d76) [0x7fdcdff35d76]
[0x1ebf47506362]
2017-05-19T23:34:33.570+0200 Error: assertion src/mongo/client/dbclientinterface.h:231 at src/mongo/shell/mongo.js:148
exception: connect failed
Any idea? :\ Thanks
Solved upgrading mongod from 2.6 to 3.0.15
If you don't want to upgrade to a newer version of MongoDB you can also just drop the mongodb:// from the beginning. For example change:
mongo mongodb://username:password#localhost:myPort/myDb
to:
mongo username:password#localhost:myPort/myDb
Ref: https://jira.mongodb.org/browse/SERVER-15739?focusedCommentId=1000536&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-1000536
I'm trying to send the result of mongo query to a file using mongo shell. I had used this following command.
C:\>mongodb\bin\mongo localhost/mydb –eval "db.docs.count()" >> counttest.txt
Actually my text file got created with this stack trace.
2016-05-13T12:35:51.485+0530 I CONTROL [main] Hotfix KB2731284 or later update is not installed, will zero-out data files
MongoDB shell version: 3.2.1
connecting to: localhost/mydb
loading file: –eval
2016-05-13T12:35:51.541+0530 E - [main] file [–eval] doesn't exist
failed to load: –eval
With --eval, I'm facing this error:
Error parsing command line: unrecognised option '-ΓÇôeval' try 'mongo --help' for more information
Can anyone please help me out regarding this issue?
I am new to mongodb, I am able to get my nodejs appserver started with mongodb 2.4 and 2.6. I have a requirement to test the latest mongodb, which is 2.8 with our app. I am able to start the mongodb 2.8 but when I try to start my nodejs appserver, I get following error.
2015-01-16T18:43:51.115Z <warn> globals.js:45 () MONGO URI = mongodb://myuser:password#localhost:27017/test
2015-01-16T18:43:51.178Z <error> globals.js:45 () #### Error in connecting to mongodb
2015-01-16T18:43:51.180Z <error> globals.js:45 () { [MongoError: auth failed] name: 'MongoError', ok: 0, errmsg: 'auth failed', code: 18 }
2015-01-16T18:43:51.182Z <error> globals.js:45 () MongoError: auth failed
.........
Also, I have created myuser in the test db and authenticated it successfully. Please help, I have tried all possible ways and with no success. Thank you very much in advance. (my environment is Ubantu Linux 14.04, virtualbox) One more thing that I forgot to mention is that I am using wiredTiger storageEngine. I tried with MMAPv1 as well and same result.
I had the same issue. It worked for me on Mac, but on Linux I hit this failure until I upgraded module mongoose from 3.6.x to 3.8.x (3.8.25). That solved the problem for me. You might consider doing the same, at least to rule out this problem.