MBS MongoDB Plugin - Question when client is on Linux

My question is regarding the MBSMongoDB plugin…

I’m venturing into the MongoDB universe for a new project, all hosted on DigitalOcean. However, I’m not having any luck getting it to work in a web app hosted on that Debian host.

I’m using the MBSMongoDB plugin to connect and interact.

On DigitalOcean, I’m currently using:

  • Droplet: Debian 11
  • Managed Database (MongoDB)

I don’t think it’s a “Xojo”-issue itself, because my app does load and display in the browser. I have a textfield and button that should add a new record to my hosted MongoDB…

Problem:
On my local Mac (M1, Ventura), when I run the app in the browser locally, it works and actually does add a record to my hosted DB.
But, when doing the same thing with the same app on my hosted Debian 11 server, everything displays (so I’m able to push the “go” button), but no record is ever added.

I know this is probably due to some Linux setting I’m missing, but had a question regarding the MBSMongoDB plugin…

Question 1:
If anyone here knows - Do I need to also install the MongoDB package onto my Debian server for the MBSMongoDB plugin to successfully work - Or does it contain a whole bundled library, which negates the need to install the actual MongoDB package separately?

On the MongoDB site, it looks like “mongosh” is used with current versions, which I’m not sure if the MBS plugin is using to send the requests/commands/etc.?

Question 2:
When clicking on the button when it’s hosted, in the web inspector I do get an error that says:

jquery-3.5.1.min.js:2
POST https://EXAMPLE.com/36AE389CFF37F982B96A811A02620B06C7A625BFECBDCA1255FA687CCB1CE784/comm/event/xrA3ZG.Pressed 404 (NOT FOUND)

So, the request appears to not go anywhere. However, I’m not sure where it’s trying to point to. I can’t seem to find the right parameter to query in the MBS plugin to see what happened.

If any other details would help, please let me know. Again, this is regarding a web app using MongoDB, through the MBS plugins.
Thank you very much in advance for any info or help.

There is no need to install extra software, since our plugin includes the libraries.

The error is probably about some error from the browser connecting to the app, but I can’t help much there.

Ah ok - Thanks for confirming that it doesn’t need to be installed (that definitely helps me focus more on the networking). Like you mentioned, it’s most likely some firewall setting on the server(s) or some blocked port, etc.
Thanks again!

If may be good to just make a button in your web app to try got list the collections or database on your mongoDB server, so you can see whether it connects correctly.

I just migrated your “MongoDB Test” into a Web project, and it seems to work fine when I use it locally (It connects to the remote db perfectly), and the fields update as I connect via my local Mac to a hosted DigitalOcean Managed MongoDB db, but keep running into this error on the Linux (Debian) web host:

MongoExceptionMBS: Error 15:13053: No suitable servers found (serverSelectionTryOnce set): [TLS handshake failed: certificate verify failed (19): self signed certificate in certificate chain calling hello on ‘db-mydatabasenameishere.mongo.ondigitalocean.com:27017’]

I’m still trying…but still no luck. On DigitalOcean, you do not have access to edit the MongoDB’s config file (or if you do - I haven’t found how), so I can’t disable/enable options.

Is there a parameter that I’m missing, or something in the Xojo code that I can edit that you know offhand that might help fix this?

On the remove web server that the Xojo app is running on, when I change the url string to change “tls=true” → “tls=false”, it gets rid of the “TLS handshake…” part of the error, but the actual connection still fails. Thanks again for any ideas you might have.

You may just add a parameter with “tlsInsecure=false” to disable verification.
Or you get a root certificate file and use the tlsCAFile parameter to point to the pem file.
e.g. cacert.pem from here

Great! - Works!
Thank you Christian, I truly appreciate your help…

It looks like it’s a TLS issue on my web app server (The Managed MongoDB on DigitalOcean seems to now work perfectly; as well as on Atlas - Just in case anyone else is interested).

I tried all kinds of flags, but didn’t see the one you mentioned. I actually had to flip the value to “true” to make it work on my server, so just:
“tlsInsecure=true

And now, it works perfectly. Thanks once more. I’ll deal with my server’s apparent TLS issue later, but I’m at least able to move onto the actual other parts of the app. Thanks!