Hostname of your mongodb server

I’m trying to follow the tutorial for hooking up to a mongol database. Does anyone know how I would find “hostname of your mongodb server”. I’ve spent hours trying all different things.

Where is the database hosted? would be a hostname for example.

For what it’s worth, it’s always helpful to provide links to projects you’re trying to replicate, so that we don’t have to go out there to try and find them.
The same goes for any additional information that you might have (and we don’t), such as the location of the database in this instance.
It also never hurts to mention what you’ve tried, so we don’t have to suggest things you’ve already done.

1 Like

I tried to paste a screenshot. Not sure if that worked.

this is the web address of the mongol database:

Here is what I just tried for hostname in my flow and you can see the errror on the right

“MongoError: failed to connect to server [] on first connect [MongoError: connect ECONNREFUSED]”

Here’s the tutorial I’m trying to follow

. It doesn’t give much help in setting up mongol. I signed up for a trial account and created a cluster and a database and a collection.

I’ve tried copying the connection string here and other stuff

Of the 3 subjects I’ve posted here, so far, I’ve solved 2 on my own. Someone please help me on this one. Don’t make me solve it without your help again :wink:

Hopefully no one is offended…I plan on becoming an expert, so hopefully I can give back at some point. (if I haven’t already)

Future posts you can look forward to from me:

OK so i’ve created a database, now what the hell do I do (I mean, everything outside of particle is really complicated)?

Oh shit, my device stopped working, now what the hell do I do?

Oh shit, now that my device has been installed, Cellular signal sucks at new location, now what the hell do I do?

Is there a definitive list of commands and instructions on how to use them, for firmware?

Is there a definitive list of commands and instructions on how to use them, for Rules Engine?

Why do I have to hook particle up to all these other things? Why don’t they just make it possible to do all that stuff from within the particle environment (database, dashboards, text messaging, hosting)?

And if I’m lucky:

Oh shit they want more, now what the hell do I do?

Kudos to you for solving the two yourself, but you didn’t leave a lot of time between posting and solving :wink:
First post 10 hours ago and you did get some initial replies within minutes AFAICT.

Uhm, yes. All the commands and instructions C/C++ provides plus the ones listed in the Particle reference docs.

You may need to wait for the docs to evolve over time as this is a rather new tool in the Particle toolset, but there again you should already be able to browse the descriptions of all the listed nodes plus everything JS hands you to add your own nodes.

Or one step further, why does your ISP not provide an IoT solution (hardware and backend) plus all the other things you were listing?
Better still, why does Starbucks and McDonalds not join together and add all of the above so that I can have my coffee and fast food and all that tech stuff from one company? This would save me the hassle of interacting with all these separate companies completely - banking and housing and healthcare and … would be good to incorporate too.

Now to your initial question

The MongoDB docs feature this link
which helps you understand the make-up of the connection string.

Hence, from looking at your screenshot of the connection string, I’d guess one of the possible hostnames to be (there are alternative ones too)

BTW, I’ve never used MongoDB before either. I just used Google and your provided screenshots to come up with the above assumption.

Ha Ha, thanks for the response ScruffR.

I figured if I pressed that button someone would respond to both humiliate me and illuminate me at the same time.

I know I haven’t given much time for folks to respond, but time is something I don’t have right now,

I like the way they explain things at They do a really good job of explaining and giving an example of code in use. Do all the commands from arduino work with particle? I know there are particular commands for particle, but are you saying all that arduino stugg + particle particulars.

Ha ha ha, I love the utopian socialist tech visionary future your painted for me. Maybe I’m just ahead of my time…sorry I am so green, each hurdle I’ve overcome, has been like climbing a mountain. and every time I get to the top I see another mountain.

So I’ve finally gotten to the point were I am saving publications to a firebase database, and now I’ve got to connect firebase to something else to do anything with it. I’ve created so many usernames and passwords and authentication secrets in the last week that the only person I can guarantee won’t be able figure out how to gain access will be me, ha ha ha

This is why I wanted to also try Mongol in the hopes that once I get it working it might be easier to do something meaningful with the data there than it is with firebase, which it probably will not…

So, you are suggesting that I just paste in only one of the hosts in the list pictured below? What does kjjyi mean? do I paste that too? Why does only the last one say shard-0&authSource=admin&retryWrites=true?

Is there anyone on this board who has succefuly hooked up to mongol, who could take a look at thier rules engine settings and share what they have done for host name?

Like I don’t understand why I would need to have the username and password in the hostname if there are fields below hostname that ask for username and password. You would thing thats for authentication purposes at login and it would not be neccessary in the hostname. here are my setting in second image below.

Probably not all, especially not the commands that are specifically aimed at the AVR chips commonly used on Arduino devices, but most of them should work.

This is what I’d try :see_no_evil: But being curious I’d also try adding the comma separated hosts list :wink: Playing with combinations won’t hurt but can be enlightening :sunglasses:

My guess would be that this is just some random/arbitrary extension MongoDB assigns to its virtual hosts in order to allow thousands of potential users access to their “own” server. This could be anything, but for your cluster that’s the identifier they chose for you - so yes, you need to add that too (as I actually did when I typed one hostname out in my post above).

It doesn’t. The list of hosts is separated by commas, but the list ends at the forward slash (/). So it’s not the last host featuring these additional “parameters”, but its the list that is followed by the other parameters (one of which is replicaSet=Cluster0-shard-0).

Again, you don’t. The access credentials are just prepended to the hostname, they are not part of the host name. This syntax is common (but outdated for security reasons) for other URIs too.
(That’s why the syntax description, I quoted above, has got them marked as optional - enclosed in square brackets [ .... ])
But since the Rules Engine node does feature dedicated fields for the credentials, you won’t have to prepend them yourself. The node will build the connection string by use of the individual fields combining them the way MongoDB expects them to be combined

Just to reiterate: The connection string is a full URI (with protocol designator, authentication, hostname(s), port(s), path and parameters). When you are “asked” for any individual part of that URI (e.g. by the input fields of the node) you just need to locate the respective part of the URI, “extract” it and enter it as individual value.


I’d not say I humiliated you :wink: I may have been teasing or mocking you at points, but not to be nasty - promise! :panda_face:

1 Like