MongoDB.OpenDefaultDatabase
---------------------------

Selects default database.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [MongoDB](component_MongoDB.md) | [12.3](newinversion123.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "MongoDB.OpenDefaultDatabase"; MongoDBRef ) 

**MBS**( **"MongoDB.OpenDefaultDatabase";** /\* Selects default database. \*/  
**$MongoDBRef**) /\* The reference number for the mongo connection.e.g. $MongoDB \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| MongoDBRef | The reference number for the mongo connection. | $MongoDB |

### Result

Returns OK or error.

### Description

Selects default database.  
Get the database named in the MongoDB connection URI, or "" if the URI specifies none.  
Useful when you want to choose which database to use based only on the URI in a configuration file.  
### See also

- [MongoDB.SetDatabase](MongoDBSetDatabase.md)

### Example Databases

- [MongoDB/MongoDB Blog](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/MongoDB/MongoDB%20Blog.shtml#16ScriptAnchor_)

This function checks for a license.

Created 22nd May 2022 , last changed 22nd May 2022

  
[MongoDB.OpenDatabase](MongoDBOpenDatabase.md) - [MongoDB.Ping](MongoDBPing.md)

[HTML Version](MongoDBOpenDefaultDatabase.shtml)