Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
12.2
12.3
12.4
12.5
13.0
13.1
13.2
13.3
13.4
13.5
Statistic
FMM
Blog
Sets the URI.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
MongoDB | 12.3 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example |
---|---|---|
MongoDBRef | The reference number for the mongo connection. | $MongoDB |
URI | The URI to use. | "mongodb://localhost/" |
Returns OK or error.
Connect to local server:
Set Variable [ $r ; Value: MBS( "MongoDB.SetURI"; $Mongo; "mongodb://localhost/" ) ]
Connect to local server with replication set and timeout:
Set Variable [ $r ; Value: MBS( "MongoDB.SetURI"; $Mongo; "mongodb://localhost/?replicaSet=rs0&connectTimeoutMS=300000" ) ]
Query options from URL:
Set Variable [ $Mongo ; Value: MBS( "MongoDB.New" ) ]
#
# set URL with options
Set Variable [ $r ; Value: MBS( "MongoDB.SetURI"; $Mongo; "mongodb://test@1.2.3.4/?ssl=true&tlsCAFile=" & GetAsURLEncoded ( "/Users/cs/cacert.pem" )) ]
#
# query and show options
Set Variable [ $options ; Value: MBS( "MongoDB.GetOptions"; $Mongo ) ]
Show Custom Dialog [ "Options" ; $options ]
#
# success
Exit Script [ Text Result: $Mongo ]
Connect to online server for mongodb with certificate network:
Set Variable [ $r ; Value: MBS( "MongoDB.SetURI"; $Mongo; "mongodb+srv://test.6gtstkv.mongodb.net/?authSource=%24external&authMechanism=MONGODB-X509&retryWrites=true&w=majority&tlsCAFile=%2FUsers%2Ftest%2FMongoDB%20online%2Fcacert.pem&tlsCertificateKeyFile=%2FUsers%2Ftest%2FMongoDB%20online%2FX509-cert.pem" ) ]
This function checks for a license.
Created 22nd May 2022, last changed 6th August 2023