MongoDB.ClientCommand
---------------------

Execute a command on the server, interpreting options according to the MongoDB server version.

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

MBS( "MongoDB.ClientCommand"; MongoDBRef; dbName; Command { ; Options } ) 

**MBS**( **"MongoDB.ClientCommand";** /\* Execute a command on the server, interpreting options according to the MongoDB server version. \*/  
**$MongoDBRef**; /\* The reference number for the mongo connection.e.g. $MongoDB \*/   
**$dbName**; /\* The name of the database.e.g. "admin" \*/   
**$Command**; /\* The command as JSON.e.g. "{ \\"hello\\": 1 }" \*/   
**$Options**) /\* Optional; JSON with options. \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| MongoDBRef | The reference number for the mongo connection. | $MongoDB |  |
| dbName | The name of the database. | "admin" |  |
| Command | The command as JSON. | "{ \\"hello\\": 1 }" |  |
| Options | JSON with options. |  | Optional |

### Result

Returns JSON or error.

### Description

Execute a command on the server, interpreting options according to the MongoDB server version.   
To send a raw command to the server without any of this logic, use [MongoDB.Command](MongoDBCommand.md).  
  
Read preferences, read and write concern, and collation can be overridden by various sources.   
### See also

- [MongoDB.ClientCommandQuery](MongoDBClientCommandQuery.md)
- [MongoDB.Command](MongoDBCommand.md)

### Release notes

- **Version 16.0**
    - Rewrote [MongoDB.ClientCommandQuery](https://www.mbsplugins.eu/MongoDBClientCommandQuery.shtml) function.
- **Version 14.2**
    - Added [MongoDB.ClientCommand](https://www.mbsplugins.eu/MongoDBClientCommand.shtml), [MongoDB.ClientCommandQuery](https://www.mbsplugins.eu/MongoDBClientCommandQuery.shtml) and [MongoDB.ClientCommandWithServerId](https://www.mbsplugins.eu/MongoDBClientCommandWithServerId.shtml) functions.

### Blog Entries

- [News in MBS FileMaker Plugin 14.2](https://www.mbsplugins.de/archive/2024-05-21/News_in_MBS_FileMaker_Plugin_1/monkeybreadsoftware_blog_filemaker)
- [Neues MBS Plugin 14.2 für Claris FileMaker](https://www.mbsplugins.de/archive/2024-05-14/Neues_MBS_Plugin_142_für_Clar/monkeybreadsoftware_blog_filemaker)
- [MBS Plugin 14.2 for Claris FileMaker](https://www.mbsplugins.de/archive/2024-05-14/MBS_Plugin_142_for_Claris_File/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 14.2pr1](https://www.mbsplugins.de/archive/2024-04-02/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 20th March 2024 , last changed 20th March 2024

  
[MongoDB.ChangeStreamResumeToken](MongoDBChangeStreamResumeToken.md) - [MongoDB.ClientCommandQuery](MongoDBClientCommandQuery.md)

[HTML Version](MongoDBClientCommand.shtml)