Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

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 14.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "MongoDB.ClientCommand"; MongoDBRef; dbName; Command { ; Options } )   More

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.

Read preferences, read and write concern, and collation can be overridden by various sources.

See also

Release notes

  • Version 14.2
    • Added MongoDB.ClientCommand, MongoDB.ClientCommandQuery and MongoDB.ClientCommandWithServerId functions.

Blog Entries

This function checks for a license.

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


MongoDB.ChangeStreamResumeToken - MongoDB.ClientCommandQuery