Connecting to MongoDB
QuickStart Module
This quickstart module shows you how to create connections to your MongoDB databases.
Connection Types
There are 2 types of MongoDB connections in OpenDataDSL:
- The private connection - this is used as the default location and also stores your configuration information
- Named connections - these are connections to MongoDB servers and clusters to access existing data
Private connection
Community version
The community version private connection defaults to mongodb://localhost:27017
To change this:
- Go to the ODSL settings in VSCode (press ctrl, or select File -> Preferences -> Settings)
- Type odsl in the search box
- Change the MongoDB connection string in the setting odsl.c.mongodb

No MongoDB Connection Setting?
Check you have the ODSL Community Version installed
Commercial versions
All the commercial versions private connection default to your own managed MongoDB database in our secure MongoDB cluster.
To change this, run the following code in an odsl file (see here for information on how to run code in odsl files).
tenant = Object()
tenant.mongodb = "<your connection string>"
save ${tenant:tenant}