Connection String Invalid | MongoDB

Hi,

Following "https://www.youtube.com/watch?v=QSO4vIePxqs&t=1s" video 

I have created a free-tier MongoDB account, and was trying to connect to the environment

But , I am getting error saying connection string invalid "mongodb+srv://dboutsystems:mipmyeznzxhks8q3@cluster0.l5nna.mongodb.net/MyEquipment?retryWrites=true&w=majority" , can anyone please help me with this problem? \

Thankyou

Solution

Hello Ritesh,

Is it possible for you to change mongodb+srv to just mongodb in the connection string and try it?

Regards,

- AJ

Hello Ritesh,

As per I saw on this URL

https://stackoverflow.com/questions/56249526/failed-to-parse-mongodb-uri-mongodb-invalid-host-string-in-uri

changing the name of the file from .env  to .env.local, may be works for you

Thanks and Regards,

Akshay Deshpande


Hello Akshay,

I have not used any "env" file for the configuration, I have used site property named connection string

Thankyou

Hello Ritesh Ghate,

Error "connection string invalid" is not something related to outsystems.

You need to verify the connection string created in  MongoDB.

Follow the steps, in the below documents to create a valid connection string.

https://medium.com/@mennohoogsteen/use-a-free-mongodb-with-outsystems-da6135210c28

Hope this helps!

Regards,

Ellakkiya.S


Solution

Hello Ritesh,

Is it possible for you to change mongodb+srv to just mongodb in the connection string and try it?

Regards,

- AJ

Thankyou AJ this worked for me, but now i'm facing connection time out error

Happy to hear that resolved the connection string issue Ritesh.

As for the time out error, I would recommend starting a new thread and share the error stack / log information from service center please. It will help the community identify the root cause faster. Thanks!

AJ


Replying to AJ.'s comment on 20 Jul 2021 04:03:19

A timeout occured after 30000ms selecting a server using CompositeServerSelector{ Selectors = WritableServerSelector, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 } }. Client view of cluster state is { ClusterId : "1", ConnectionMode : "Automatic", Type : "Unknown", State : "Disconnected", Servers : [{ ServerId: "{ ClusterId : 1, EndPoint : "Unspecified/cluster0.l5nna.mongodb.net:27017" }", EndPoint: "Unspecified/cluster0.l5nna.mongodb.net:27017", State: "Disconnected", Type: "Unknown", HeartbeatException: "MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server. ---> System.Net.Sockets.SocketException: No such host is known
at System.Net.Sockets.Socket.InternalEndConnect(IAsyncResult asyncResult)
at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MongoDB.Driver.Core.Connections.TcpStreamFactory.<ConnectAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MongoDB.Driver.Core.Connections.TcpStreamFactory.<CreateStreamAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MongoDB.Driver.Core.Connections.BinaryConn

Hello Ritesh,

Please review the following article. In the past I had no issues connecting OutSystems app to MongoDB using the steps listed here:

https://medium.com/@mennohoogsteen/use-a-free-mongodb-with-outsystems-da6135210c28

Some of the screenshots in the article are now a bit different in MongoDB but you will be able to easily negotiate those changes. I believe you are just  missing a step or two for e.g. that part where you set your IP address.

By the way, you are displaying your password in the connection string in your original post. If so please remove it and place a generic <password> tag and additionally recreate a new password.

Regards,

AJ

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.